'cannot retrieve value from database for textbox while other field is fine
As you can see, all text box have value but did not appear, while the field that were not text box only can appear.. I've checked = "" (maybe symbols issue) but did not find anything.
$id=$_GET['updateosaid'];
$sql4="SELECT * FROM `agreement` WHERE `id`=$id"; $statement4=mysqli_query($con,$sql4); $row=mysqli_fetch_assoc($statement4);
$cnum=$row['cnum'];
$sc_num=$row['sc_num'];
$sn=$row['sn'];
$ck=$row['ck'];
$mac_a=$row['mac_a'];
$mosa_date=$row['mosa_date'];
$mosa_time=$row['mosa_time'];
$engene=$row['engene'];
$ctr=$row['ctr'];
this is the code that will call the value:
Contract Number:<br>
<select class="drop" name="cnum" value ="<?php echo $cnum;?>" selected="selected">
<?php
include "config.php";
//connect db
$sql2 = "SELECT * FROM `osa`";
$result2=mysqli_query($con,$sql2);
//display in option
while($row=mysqli_fetch_array($result2)){
$code=$row['cnum'];
$amount=$row['osa_num'];
echo "<option value='$code'>".
"$code".
"</option>";
}
?>
</select>
</div>
<div class="column">
Support Case Number:<br>
<input type="text" id="sc_num" class="bg size" autocomplete="off" value="<?php echo $sc_num;?>"><br><br>
</div>
<div class="column">
Serial Number:<br>
<input type="text" id="sn" class="bg size" autocomplete="off" value="<?php echo $sn;?>"><br><br>
</div>
<div class="column">
Certificate Key:<br>
<input type="text" id="ck" class="bg size" autocomplete="off" value="<?php echo $ck;?>"><br><br>
</div>
<div class="column">
MAC Address:<br>
<input type="text" id="mac_a" class="bg size" autocomplete="off" value="<?php echo $mac_a;?>"><br><br>
</div>
<div class="column">
Date:<br>
<input class="bg" type="date" name="mosa_date" value="<?php echo $mosa_date; ?>"><br><br>
</div>
<div class="column">
Time:<br>
<input class="bg" type="time" name="mosa_time" value="<?php echo $mosa_time; ?>"><br><br>
</div>
<div class="column">
Assigned Engineer:<br>
<input type="text" id="engene" class="bg size" autocomplete="off" value="<?php echo $engene;?>"><br><br>
</div>
<div class="column">
Counter:<br>
<input type="number" id="ctr" class="bg size" value="<?php echo $ctr;?>"><br><br>
</div>```
Solution 1:[1]
Check the table SCHEMA "SELECT * FROM agreement WHERE id=$id";
if it is same as the key you echo for the text box value, check the spelling if they are the same.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | klinsman Agam |
