我的代码似乎不起作用。有人可以帮忙解决这个问题吗?它检查第一个变量$ editID,但下一个'$ key'不起作用。
非常感谢每一位帮助。
以下代码:
<?php
$editID = $_POST['editID'];
if (isset($editID)) {
$key = $_POST['Key'];
if (isset($key)) {
$clientName = $_POST['clientName'];
echo $clientName;
} else {
$owner = $current_user->ID;
global $wpdb;
$sql="SELECT * FROM clients WHERE clientID=$editID";
$clients = $wpdb->get_results($sql);
foreach ($clients as $client)
{
<form role="form" method="POST">
<div class="form-group">
<label>Client Name</label>
<input class="form-control" name="clientName" value="<?php echo $client->clientName;?>" required>
</div>
<input type="hidden" id="Key" name="Key" value="<?php echo $key; ?>">
<button value="submit" type="submit" class="btn btn-default">Update</button>
</form>
<?php
}
}
} else {
echo "Nothing to edit? Please <a href="">go back</a>.";
}
?>