I have a form that autopopulates and allows user to make changes where necessary. In this form are some drop down menus (hardcoded on the page). All the selections (50 states for example) are there. If I select a state it will then post to the database. If I don't select a state and just leave it as the previously selected state (not change the selection already made by a user) it puts a blank in the database.
Examples:
The <?="$rest_state_pr"?> will pull the state the user selected previously. If I change the slelection it saves the new selection, but if I leave it as the "default" It puts a blank in the database.
Drop Down:
<td><select name="rest_state_pr" class="formTextbox" value="<?="$rest_state_pr"?>">
<option value=""><?="$rest_state_pr"?></option>
<option value="Alabama">Alabama</option>
<option value="Alaska">Alaska</option>
<option value="Arizona">Arizona</option>
<option value="Arkansas">Arkansas</option>
<option value="California">California</option>
<option value="Clorado">Colorado</option>
</select></td>
Form and Query:
<form name="FormName" action="table_order_handler.php" enctype="multipart/form-data" method="post">
<?php
$query="SELECT * FROM abc_tables WHERE table_id=$table_id";
$result=mysql_query($query);
while ($row = mysql_fetch_assoc($result))
{
$rest_state_pr = $row['rest_state_pr']
}
?>
Handler:
<?php
$query_update="UPDATE abc_tables SET rest_state_pr='$rest_state_pr' WHERE table_id='$table_id'";
mysql_query($query_update) or die(mysql_error());