i am currently in the process of trying to create a change address form linked to the database
on the registration form it has a drop down of country listed with countries from a database
how would i recive this data as a drop down again but with the chosen option selected?
and then how would i get the drop down to update the form from that current page too?
Many thanks in advance
This is the code for the file in (user_reg_inc.php)
Code: Select all
$country=$_POST[cbocountry];
if(empty($country))
{
$err_city_sql="select * from error_message where err_id=23";
$err_city_res=mysql_query($err_city_sql);
$err_city_row=mysql_fetch_array($err_city_res);
$err_country=$err_city_row[err_msg];
$err_flag=1;
}
$sql.="country";
$sql.="''$country";
$state_sql="select * from state_master where country_id=38 ";
$state_res=mysql_query($state_sql);
$county_sql="select * from county_master";
$county_res=mysql_query($county_sql);
$country_sql="select * from country_master";
$country_res=mysql_query($country_sql);
This is code from (user_reg.tpl)
Code: Select all
<? if(!empty($err_country))
{
?>
<tr><td> </td><td><a href="user_reg.php#cbocountry">country</a> - <?= $err_country; ?></td></tr>
<?
}
?>
<td>
<? if(!empty($err_country))
{
?>
<img src="images/warning_9x10.gif"> <font size=2 color=red><?= $err_country ?></font>
<br>
<font size=2 color=red>Country</font></b>
<?
}
else
{
?>
<span class="style2">
<font size=2>Country </font></b></span><font color="#FF0000">*</font>
<?
}
?> </td>
</tr>
<td><select name=cbocountry id="txtzipcode">
<option value=0>Select</option>
<?
$country_sql="select * from country_master";
$country_res=mysql_query($country_sql);
while($country_row=mysql_fetch_array($country_res))
{
if(trim($country_row['country_id'])==trim($country))
{
?>
<option value="<?= $country_row['country_id'] ?>" selected><?= $country_row['country']?></option>
<?
}
else
{
?>
<option value="<?= $country_row['country_id'] ?>"><?= $country_row['country']?></option>
<?
}
}
?>
</select>
</td>
</tr>
<tr><td>
Would there be a way to use the above code and echo that some how?