Forum Moderators: coopster
I am trying to do the following : select a country from a dynamic drop down list and then add a province to that country and post the countrycode for that province with the province . The problem is i get a blank country code. Any suggestions would be very thankful for.
The variable i am posting for country code is $id.
Province1.php
<?
Include ("connect.php");
$sql="select * from Country";
$result=mysql_query($sql);
while ($row=mysql_fetch_array($result)) {
$id=$row["Countrycode"];
$thing=$row["Country"];
$options.="<OPTION VALUE=\"$id\">".$thing;
}
?>
<form name ="input" action="Process_province.php" method="post">
<SELECT NAME=thing>
<OPTION VALUE=0>Choose
<?=$options?>
</SELECT>
<td>Province:</td><td> <input class="input" type="text" name="province"/></td>
<input type="submit" value="submit"><br>
</form>
</Body>
</html>
Process_province.php
<?
Include ("connect.php");
$province=$_POST[province];
$Id=$_Post[Id];
$sql="INSERT INTO province (Provincecode,Province,Countrycode) Values ('','$province','$id')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added" ;
?>
</div>