gpt4 book ai didi

php - mysqli 无法显示完整数据

转载 作者:行者123 更新时间:2023-11-29 06:50:23 24 4
gpt4 key购买 nike

我有一个名为 testads 的表,数据如下

Link to table image

我想制作一个更新页面,其中数据按行选择。我更新数据没有问题,但是当数据显示在更新页面时,它只显示Subway,而不是公司名称Subway Malaysia。所有具有多个单词的数据都会发生这种情况。我似乎找不到问题所在

以下是 PHP 代码:

<?php
include('./include/connection.php');

$ID=$_GET['no'];

$query = "SELECT no, id_company, company_name, jobName,state, location, jobDesc, contact FROM testads where no='$ID'";

$result = mysqli_query($link, $query) or die ("error.");

while ($row = mysqli_fetch_array($result)){
$id=$row['no'];
?>

<form class="form-horizontal form-label-left" method="post" action="edit_query.php<?php echo '?no='.$id; ?>">
<div class="form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="comp-name">Company Name <span class="required"></span>
</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<input type="text" id="comp-name" required="required" name="cname" class="form-control col-md-7 col-xs-12" value=<?php echo $row['company_name']; ?>>
</div>
</div>

<div class="form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="comp-id">Company ID <span class="required"></span>
</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<input type="text" id="comp-id" required="required" name="cid" class="form-control col-md-7 col-xs-12" value=<?php echo $row['id_company']; ?>>
</div>
</div>

<div class="form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="job-name">Job Name <span class="required"></span>
</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<input type="text" id="job-name" required="required" name="jname" class="form-control col-md-7 col-xs-12" value=<?php echo $row['jobName']; ?>>
</div>
</div>

<div class="form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="desc">Job Description<span class="required"></span>
</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<textarea id="desc" name="description" class="form-control" maxlength="2000" value=<?php echo $row['jobDesc']; ?>></textarea>
</div>
</div>

<div class="form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="stt">State</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<select name="state" class="form-control">
<option value="Johor"<?php echo $row['state'] == 'Johor' ? 'selected="selected"' : '' ; ?>>Johor</option>
<option value="Malacca"<?php echo $row['state'] == 'Malacca' ? 'selected="selected"' : '' ; ?>>Malacca</option>
<option value="Pahang"<?php echo $row['state'] == 'Pahang' ? 'selected="selected"' : '' ; ?>>Pahang</option>
<option value="Selangor"<?php echo $row['state'] == 'Selangor' ? 'selected="selected"' : '' ; ?>>Selangor</option>
</select>
</div>
</div>

<div class="form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="loc">Location<span class="required"></span>
</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<input type="text" id="loc" required="required" name="location" class="form-control col-md-7 col-xs-12" value=<?php echo $row['location']; ?>>
</div>
</div>

<div class="form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="ctc">Contact<span class="required"></span>
</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<input type="text" id="ctc" required="required" name="contact" class="form-control col-md-7 col-xs-12" value=<?php echo $row['contact']; ?>>
</div>
</div>

<div class="form-group">
<div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3">
<button class="btn btn-success" type="submit" name="submit">Update</button>
</div>
</div>

</form>

最佳答案

您需要引用您的值(value)观:

<input ... value="<?php echo $row['company_name']; ?>">

关于php - mysqli 无法显示完整数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47726752/

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