Code: Select all
<?
if(isset($_POST['submit'])){
$user_name = $_POST['user_name'];
$user_address = $_POST['user_address'];
$user_city= htmlentities($_POST['user_city'], ENT_QUOTES);
$qupdate = mysql_query("UPDATE user SET user_name='$user_name',user_address='$user_address',user_city='$user_city' WHERE user_id='$user_id'");
}
function city(){
global $quser;
$qship =mysql_query("SELECT DISTINCT ship_city FROM ship ORDER BY ship_city ASC");
echo "<select name=\"user_city\"><option select> - choose city - </option>";
while($rship = mysql_fetch_array($qship))
{echo "<option value=\"$rship[ship_city]\">$rship[ship_city]</option>";}
echo "</select>";
echo " $quser[user_city]";
}
?>
Current Value
[text]
user_name address city
john street 1 nyc
[/text]
After Update(if I only change the user_name=max)
[text]
user_name address city
max street 1 choose city
[/text]
Even I dont use "choose city" as default, it will post first value on the list.
How stop the city from keep submit into db?
Is there anyway to post only what I want to post?
Like if I only change the user_name, and keep the current address and city.
thanks.