我正在尝试编辑前端表格中的数据。单击“编辑”时,表单不显示任何内容,只显示空字段
Html Code
<form action="" id="postjob" method="post">
<table>
<tr>
<td><label for="team_uniqueid">UniqueID:</label></td>
<td><input type="text" name="team_uniqueid" id="team_uniqueid" value=""/></td>
</tr>
<tr>
<td><label for="team_firstname">FirstName:</label></td>
<td><input type="text" name="team_firstname" id="team_firstname" value="" /></td>
</tr>
<tr>
<td><label for="team_lastname">LastName:</label></td>
<td><input type="text" name="team_lastname" id="team_lastname" /></td>
</tr>
<tr>
<td><label for="team_emailid">EmailId:</label></td>
<td><input type="text" name="team_emailid" id="team_emailid" /></td>
</tr>
<tr>
<div class="full_wrap">
<div class="sub_wrap">
<select name="page_id" id="page_id">
<?php
global $post;
$args = array( \'numberposts\' => -1);
$posts = get_posts($args);
foreach( $posts as $post ) : setup_postdata($post); ?>
<option value="<?php echo $post->ID; ?>"><?php the_title(); ?></option>
<?php endforeach; ?>
</select>
<select>
<option class="au">Australia</option>
<option class="Ind">India</option>
<option class="US">United States</option>
<option class="UK">United Kingdom</option>
</select>
</div>
</div>
</tr>
<tr>
<td><button type="submit" name="insert_member">Submit</button></td>
</tr>
</table>
</form>
Edit Code
if (isset($_GET[\'edit\'])) {
$id = $_GET[\'edit\'];
$update = true;
$record = $wpdb->get_results("SELECT * FROM $tablename WHERE team_emailid = \'".$id."\'");
if($record->num_rows){
$n = $record->fetch_array();
$team_uniqueid = $n[\'team_uniqueid\'];
$team_firstname = $n[\'team_firstname\'];
$team_lastname = $n[\'team_lastname\'];
$team_emailid1 = $n[\'team_emailid\'];
}
}