I display records from one table. On every rows I add 2 columns (type of listbox). They are filled from another tables. How can I save choiced values from listboxes after Save?
<!-- Anesteziolog -->
<form name="myForm" action="cos_den.php" method="post">
<?php
echo"<td >";
$cpquery = "Select anesteziolog from anesteziolog order by anesteziolog";
$cpresult = mysql_query($cpquery) or die(mysql_error());
?>
<select name="anesteziolog" value="anesteziolog">
<!-- Drop down -->
<?php
if($cpresult)
{
while($row = mysql_fetch_array($cpresult))
{
echo '<option value="' .$row['anesteziolog']. '">'. $row['anesteziolog'].</option>';
}
}
echo "<option value='anesteziolog' ></option>";
echo "</select>";
echo "</td>";
// End: Anesteziolog
//Typ anesteziologie
echo"<td >";
$cpquery = "Select anest_typ from anest_typ order by anest_typ";
$cpresult = mysql_query($cpquery) or die(mysql_error());
?>
<select name="anest_typ" value="anest_typ">
<!-- Drop down -->
<?php
if($cpresult)
{
while($row = mysql_fetch_array($cpresult))
{
echo '<option value="' .$row['anest_typ'].'">'. $row['anest_typ']. '</option>' ;
}
}
echo "<option value='anest_typ' ></option>";
echo "</select>";
echo "</td>";
// End: Typ anesteziologie
echo "</tr>";
}
echo "</table>";
?>
<p class="submit"><input type="submit" value="Save" name="submit" ></>
</form>
luma64
0
Newbie Poster
Recommended Answers
Jump to PostSo, are you asking how you can save the state of the form elements after the page refreshes?
Or, are you asking how you can update a table in the database when the form element has been changed?
Jump to PostIf you are familiar with jQuery (or javascript) you could submit the form with an onchange event for the form elements. That would be the easiest way that I can think of to do it. Keep in mind though, this will cause the page to reload as soon as I …
All 6 Replies
pixelsoul
272
Red Pill
Featured Poster
luma64
0
Newbie Poster
pixelsoul
272
Red Pill
Featured Poster
luma64
0
Newbie Poster
pixelsoul
272
Red Pill
Featured Poster
luma64
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.