0
在我的项目中,我在表中有一个贪睡按钮,表中填充了数据库中的值。我给了一个href
这个按钮,它将打开一个引导模式对话框。从Bootstrap模式运行查询
在模态中,我已经调用了特定ID的数量。
代码模态低于:
<?php
require_once '../invoice/config.php';
$reserver = $_GET["id"];
echo $reserver;
$result = mysqli_query($con,"SELECT * FROM table_name where id = '$reserver'");
$row = mysqli_fetch_array($result);
?>
<form id="modal-form" data-remote="true" method="post" action="saveSnoozeReminder.php?id='<?php echo $reserver ?>'" >
<div class="modal-body">
<p>SELECT DATE FOR REMINDER </p>
<label>date</label>
<input type="date" name="snoozeReminderDate" />
<label>amount</label>
<input type="text" name="amt" value="<?php echo $row['amount']; ?> " disabled >
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-default" data-dismiss="modal" value="">Snooze</button>
<button type="button" class="btn btn-default" data-dismiss="modal" onClick="window.location.reload()">Close</button>
</div>
</form>
现在进一步为用户将选择日期,并按下贪睡按钮,我已经写了,将被要求表单提交和更新提醒另一个PHP文件为表中的特定ID。
另一个文件被命名为saveSnoozeReminder.php
并为它的代码是:
<?php
require_once '../invoice/config.php';
$recordid = $_GET["id"];
echo $recordid;
$snoozedate = $_POST['snoozeReminderDate'];
echo $snoozedate;
$snoozeQuery = "UPDATE paymentremainder SET reminderdate='$snoozedate' WHERE id = $recordid";
if (mysqli_query($con, $snoozeQuery)) {
$message = 'Reminder Snoozed Successfully';
echo "<SCRIPT type='text/javascript'>
alert('$message');
window.location.replace('index.php');
</SCRIPT>";
} else {
return "";
}
?>
运行此代码也后,更新查询不被解雇。有没有什么方法可以使用Ajax或什么。有人可以帮助它。