here I have another question, how can we update the database through html/php form with some of the data was populated using dropdown menu?
It is something like this:
User choose to update the asset, and the asset will display the form with the stored data, and they can just directly update the asset using that form again (this is including the dropdown menu).
Hope some of you can get back to me soon. Really appreciate it. Thank you.
Edited:
<form method="POST" name="update" action="update.php">
<h2>EDIT</h2>
<table class="reference" cellspacing="0" cellpadding="0" border="1" width="60%" id="tablecss">
<tr>
<td> Category </td>
<td> <?php echo '<select name="categoryid">';
foreach ($category as $data)
{
echo '<option'.($row['name']==$data? ' selected' : '').'>'.$data.'</option>';
}
echo '</select>'; ?> </td>
</tr>
<tr>
<td> Brand </td>
<td> <?php echo '<select name="brandid">';
foreach ($brand as $data1)
{
echo '<option'.($row['name']==$data1? ' selected' : '').'>'.$data1.'</option>';
}
echo '</select>'; ?> </td>
</tr>
<tr>
<td> Location </td>
<td> <?php echo '<select name="locationid">';
foreach ($location as $data2)
{
echo '<option'.($row['name']==$data2? ' selected' : '').'>'.$data2.'</option>';
}
echo '</select>'; ?> </td>
</tr>
<tr>
<td> Staff </td>
<td> <?php echo '<select name="staffno">';
foreach ($staff as $data3)
{
echo '<option'.($row['name']==$data3? ' selected' : '').'>'.$data3.'</option>';
}
echo '</select>'; ?> </td>
</tr>
<tr>
<td> Supplier </td>
<td> <?php echo '<select name="supplierid">';
foreach ($supplier as $data4)
{
echo '<option'.($row['name']==$data4? ' selected' : '').'>'.$data4.'</option>';
}
echo '</select>'; ?> </td>
</tr>
<tr>
<td> Project </td>
<td> <?php echo '<select name="projectid">';
foreach ($project as $data5)
{
echo '<option'.($row['name']==$data5? ' selected' : '').'>'.$data5.'</option>';
}
echo '</select>'; ?> </td>
</tr>
<tr>
<td> <input type="hidden" name="assetid" value="<?php echo "$assetid"; ?>" > </td>
</tr>
</table>
<input type="submit" name="submit" value="Update" onclick="return confirm('Update this?');">
<input type="button" value="Back" onclick="history.back();">
</form>
So, basically this can't function well. They didn't capture the stored data, but it can update into the database. Any help?
select-values after the submit? Please be more specific with your questions so we can put more effort in answering it than in guessing what it's supposed to mean.<select>elements in the form, right? And when there are some, theassetidfield returns always the same value on submit (is it empty or just always the same?), right?