hello people am new to this langauge but trying to get hold of it during my personal training i design a form to accept a continent and country with maximum of 4 cites. the connection details to mysql database is store in another file , am using latest phpMyAdmin as GUI but to my surprise when i added data to check it in phpMyAdmin i found that the data i entered is not there. what could be likely reasons why i cant find those data please?
here is source code
<!doctype html public "-//w3c//dtd xhtml1.0 transitional//EN"
"http://www.w3c.org/tr/xhtml1/dtd/transitional.dtd">
<?php
$continent = $country = $num_city = "";
if (!isset($_POST['submit']) || $_POST['submit'] != "submit")
{
$_POST['frmContinent'] = "";
$_POST['frmCountry'] = "";
$_POST['frmCity'] = "";
}
else
{
include_once("database.php");
$continent = $_POST['frmContinent'];
$country_id = $_POST['frmCountry'];
$num_city = $_POST['frmCity'];
$myconnect = mysql_connect($hostname, $username , $pword);
mysql_select_db($dbase, $myconnect)or die(mysql_error());
$Country_query ="INSERT INTO tbl_Counrty (Continent,Country)
VALUES ($continent,$country)";
$result = mysql_query($Country_query, $myconnect) or die($result .mysql_error());
$message = "Record save in tbl_country";
if ($result)
{
$counrty_id = mysql_insert_id($myconnect);
for($city = 0; $city < count($num_city); $city++)
{
$city_query ="INSERT INTO tbl_city (counrty_id , cityname)
VALUES ($country_id, $num_city[$city])";
$result_city = mysql_query($city_query, $myconnect) or die($result_city . mysql_error());
$message .= " and Tbl_city ";
}
}
}
?>
<html>
<head>
<title> Sample Data Capture </title>
</head>
<body bgcolor ="azure" >
<h1 align= "center"> Choose a Continent and Related Country with maximum of 4 cities </h1>
<form method="post" action ="<?php echo $_SERVER['PHP_SELF']; ?>">
<table border = "0" cellpadding ="5">
<tr><td><label>CONTINENT</label></td>
<td><select name = "frmContinent" size= "1">
<option> Africa</option>
<option>South America</option>
<option> North America</option>
</select>
</tr>
<tr><td><label>COUNTRY</label></td>
<td><select name = "frmCountry" size= "1">
<option>Kenya</option>
<option>Brazil</option>
<option>USA</option>
<option>Canada</option>
</select></td>
</tr>
<tr><td><label>CITY 1</label></td>
<td><input type ="text" name ="frmCity[0]" size ="50" maxlength="50" /></td>
</tr>
<tr><td><label>CITY 2</label></td>
<td><input type ="text" name ="frmCity[1]" size ="50" maxlength="50" /></td>
</tr>
<tr><td><label>CITY 3</label></td>
<td><input type ="text" name ="frmCity[2]" size ="50" maxlength="50" /></td>
</tr>
<tr><td><label>CITY 4</label></td>
<td><input type ="text" name ="frmCity[3]" size ="50" maxlength="50" /></td>
</tr>
<tr><td colspan = "2" align= "center"><input type= "submit" name = "submit" value = "Submit" />
<input type= "reset" name = "reset" value = "Clear" />
</td></tr>
</table>
</form>
</body>
</html>