gpt4 book ai didi

html - 在更新之前在 Bootstrap 模式中显示 MYSQL 数据

转载 作者:行者123 更新时间:2023-11-29 00:04:42 24 4
gpt4 key购买 nike

我在 Bootstrap 模态表单上显示数据时遇到问题。我可以在屏幕上看到数据并且一切正常,但是当我单击更新按钮编辑其中一个字段时,模态打开并且没有显示数据所以当我单击保存它然后将空白字段库保存到数据库.

我要显示的值之一是:

value="<?php echo clean($row['clientTown']); ?>"

如果我把它放在页面上除模式之外的任何地方,它就会显示数据。

感谢任何帮助,代码如下。

模态代码

<!-- -- Update Media Info Modal -- -->
<div class="modal fade" id="mediainfo" tabindex="-1" role="dialog" aria-labelledby="personalInfoLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header modal-primary">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="icon-remove"></i></button>
<h4 class="modal-title">Update Media Details</h4>
</div>
<form action="" method="post">
<div class="modal-body">

<div class="form-group">
<label for="clientArea">Hotel Area</label>
<select name="clientArea" id="clientArea" class="form-control">
<?php include 'snippets/countries.php'; ?>
</select>
</div>

<hr>

<div class="form-group">
<label for="clientMailshot">Mailshot Date</label>
<input type="date" class="form-control" name="clientMailshot" id="clientMailshot" value="<?php echo clean($row['clientMailshot']); ?>">
</div>

<div class="form-group">
<label for="clientChase">Chase Date</label>
<input type="date" class="form-control" name="clientChase" id="clientChase" value="<?php echo clean($row['clientChase']); ?>">
</div>

<div class="form-group">
<label for="clientChased">Second Chase Date</label>
<input type="date" class="form-control" name="clientChased" id="clientChased" value="<?php echo clean($row['clientChased']); ?>">
</div>

<div class="form-group">
<label for="clientAppointment">Appointment Date</label>
<input type="date" class="form-control" name="clientAppointment" id="clientAppointment" value="<?php echo clean($row['clientAppointment']); ?>">
</div>

<hr>
<div class="form-group">
<label for="clientBuyer">Media Buyer </label>
<input type="text" class="form-control" name="clientBuyer" id="clientBuyer" value="<?php echo clean($row['clientBuyer']); ?>" />
</div>

</div>
<div class="modal-footer">
<button type="input" name="submit" value="updatemediaInfo" class="btn btn-success btn-icon"><i class="icon-check"></i> Update Info</button>
<button type="button" class="btn btn-warning btn-icon" data-dismiss="modal"><i class="icon-remove-sign"></i> Cancel</button>
</div>
</form>
</div>
</div>

添加到数据库

if (isset($_POST['submit']) && $_POST['submit'] == 'updatemediaInfo') {
if($_POST['clientMailshot'] == "") {
$msgBox = alertBox("Mail Shot is a Required Field.", "<i class='icon-remove-sign'></i>", "danger");
} else {
$clientBuyer = encryptIt($_POST['clientBuyer']);

$stmt = $mysqli->prepare("
UPDATE
clients
SET
clientBuyer = ?,
clientArea = ?,
clientMailshot = ?,
clientChase = ?,
clientChased = ?,
clientAppointment = ?
WHERE
clientId = ?
");
$stmt->bind_param('sssssss',
$mysqli->real_escape_string($_POST['clientBuyer']),
$mysqli->real_escape_string($_POST['clientArea']),
$mysqli->real_escape_string($_POST['clientMailshot']),
$mysqli->real_escape_string($_POST['clientChase']),
$mysqli->real_escape_string($_POST['clientChased']),
$mysqli->real_escape_string($_POST['clientAppointment']),
$clientId
);
$stmt->execute();
$msgBox = alertBox("The Client's Personal Info has been updated.", "<i class='icon-check-sign'></i>", "success");
$stmt->close();
}
}

最佳答案

没有按钮类型=“输入”这样的东西。将其更改为按钮类型="提交"

<button type="submit" name="submit" value="updatemediaInfo" class="btn btn-success btn-icon"><i class="icon-check"></i> Update Info</button>

关于html - 在更新之前在 Bootstrap 模式中显示 MYSQL 数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28088534/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com