我写了一个插件,我必须更新perticular行,我必须通过该行的ID,如何传递ID呢?
<?php if (isset($message)): ?><div class="updated"><p><?php echo $message; ?></p></div><?php endif; ?>
<?php foreach ($rows as $row) { ?>
<tr>
<td><?php echo $row->id; ?></td>
<td><?php echo $row->moving_from; ?></td>
<td><?php echo $row->moving_to; ?></td>
<td><?php echo $row->type_of_moving; ?></td>
<td><?php echo $row->moving_date; ?></td>
<td><?php echo $row->size_of_move; ?></td>
<td><?php echo $row->user_name; ?></td>
<td><?php echo $row->user_phone; ?></td>
<td><?php echo $row->user_email; ?></td>
<td><?php echo $row->user_address_1; ?></td>
<td><?php echo $row->user_address_2; ?></td>
<td><?php echo $row->user_address_3; ?></td>
<!-- <td> <a href="<?php echo admin_url('admin.php?page=billing_form_update'); ?>">EDIT</a></td>-->
<td> <a href="<?php echo admin_url('admin.php?page=billing_form_update'); ?>">EDIT</a></td>
<!-- <td> <a href="<?php echo admin_url('admin.php?page=sinetiks_schools_create'); ?>">DELETE</a> </td>-->
</tr>
<?php } ?>
字符串
在下面的php代码中,我需要该id,但我无法更新它,当evr我更新它只是简单地重新加载
<?php
function billing_form_update() {
global $wpdb;
$table_name = $wpdb->prefix . 'billing_form';
$id = $_GET['id'];
$moving_from2 = $_POST['moving_from2'];
$moving_to2 = $_POST['moving_to2'];
$type_of_moving2 = $_POST['type_of_moving2'];
$moving_date2 = $_POST['moving_date2'];
$size_of_moving2 = $_POST['size_of_moving2'];
$user_name2 = $_POST['user_name2'];
$user_phone2 = $_POST['user_phone2'];
$user_email2 = $_POST['user_email2'];
$contact_address2 = $_POST['contact_address2'];
$moving_from_addres2s = $_POST['moving_from_address2'];
$moving_to_address2 = $_POST['moving_to_address2'];
if (isset($_POST['update'])) {
$wpdb->update(
$table_name, //table
array('moving_from' => $moving_from2,'moving_to' => $moving_to2,'type_of_moving' => $type_of_moving2,'moving_date' => $moving_date2,'size_of_move' => $size_of_moving2,'user_name' => $user_name2,'user_phone' => $user_phone2,'user_email' => $user_email2,'user_address_1' => $contact_address2,'user_address_2' => $moving_from_addres2s,'user_address_3' => $moving_to_address2), //data
array('id' => $id) //where
);
}
?>
型
1条答案
按热度按时间6l7fqoea1#
你也需要在你的链接中添加
id
,如下所示:字符串
现在,当你想在
admin.php
上获取它时,用途:-型