With regards to this post: How do i update form fields from DB after changing a <select> component
The answer given by volkerschulz suits my needs perfectly. However when I post the form using: method=’POST’ , the posted value is the $hash, not the value shown in the field.
Here is the code snippet in from the original question:
<code><form action="process_add.php" method="post">
<select name="starnumber" onchange="showCoords(this);">STAR No :
<?php echo implode(PHP_EOL, $options); ?>
</select>
<br>
<input name="xcoord" id="xcoord" placeholder="X Coord"></input><br>
<input name="ycoord" id="ycoord" placeholder="Y Coord"></input>
</form>
</code>
<code><form action="process_add.php" method="post">
<select name="starnumber" onchange="showCoords(this);">STAR No :
<?php echo implode(PHP_EOL, $options); ?>
</select>
<br>
<input name="xcoord" id="xcoord" placeholder="X Coord"></input><br>
<input name="ycoord" id="ycoord" placeholder="Y Coord"></input>
</form>
</code>
<form action="process_add.php" method="post">
<select name="starnumber" onchange="showCoords(this);">STAR No :
<?php echo implode(PHP_EOL, $options); ?>
</select>
<br>
<input name="xcoord" id="xcoord" placeholder="X Coord"></input><br>
<input name="ycoord" id="ycoord" placeholder="Y Coord"></input>
</form>
and the $hash is created earlier in the code like this:
<code>while($star=mysqli_fetch_assoc($starsr)) {
$hash = md5($star['omag']);
</code>
<code>while($star=mysqli_fetch_assoc($starsr)) {
$hash = md5($star['omag']);
</code>
while($star=mysqli_fetch_assoc($starsr)) {
$hash = md5($star['omag']);
How can I make sure the original value of the lookup is POST-ed?