i want to develop a web page containing two forms.when page loads it just display the first form and after it is filled then the second table display at the demand of user and both forms values will be stored in 2 different tables in database.i dont know what's the logic behind that. plz suggest me solution and examples link.thankyou before this is my code just for display one form but the second has the same pattern
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
if (!empty($_POST['det_loc'])) {
//do something here;
mysql_connect("localhost","root");//database connection
mysql_select_db("admin");
//inserting data into DET_LOCATION Table
$locID=$_POST["LocID"];
$latitude=$_POST["Latitude"];
$longitude=$_POST["Longitude"];
$store = "INSERT INTO det_location(LocID,Latitude,Longitude) VALUES('$locID','$latitude','$longitude')";
//declare in the order variable
$result = mysql_query($store); //order executes
if($result)
{
echo "<br>Input data is succeed";
} else{
echo "<br>Input data is fail";
}
}
if (!empty($_POST['more_loc'])) {
//do something here;
mysql_connect("localhost","root");//database connection
mysql_select_db("admin");
//inserting data into DET_LOCATION Table
$latitude=$_POST["Latitude"];
$longitude=$_POST["Longitude"];
$store = "INSERT INTO det_location(Latitude,Longitude) VALUES('$latitude','$longitude')";
//declare in the order variable
$result = mysql_query($store); //order executes
if($result)
{
echo "<br>All data is Entered";
} else{
echo "<br>Input data is fail";
}
}
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Input Detail Location</title>
</head>
<body>
<table border="1">
<tr>
<td align="center">Det_Location</td>
</tr>
<tr>
<td>
<table>
<form method="post" action="det_loc">
<tr>
<td>locID</td>
<td><input type="Integer" name ="LocID" size="20">
</td>
</tr>
<tr>
<td>Latitude</td>
<td><input type="Float" name ="Latitude" size="20">
</td>
</tr>
<tr>
<td>Longitude</td>
<td><input type="Float" name="Longitude" size="20">
</td>
</tr>
</form>
</table>
</td>
</tr>
<tr>
<td>
<input type="submit" name="det_loc" value="Add more" />
</td>
</tr>
</table>
<table border="1">
<tr>
<td align="center">More Locations</td>
</tr>
<tr>
<td>
<table>
<form method="post" action="">
<tr>
<td>Latitude</td>
<td><input type="Float" name ="Latitude" size="20">
</td>
</tr>
<tr>
<td>Longitude</td>
<td><input type="Float" name="Longitude" size="20">
</td>
</tr>
<tr>
<td>Latitude</td>
<td><input type="Float" name ="Latitude" size="20">
</td>
</tr>
<tr>
<td>Longitude</td>
<td><input type="Float" name="Longitude" size="20">
</td>
</tr>
</form>
</table>
</td>
</tr>
<tr>
<td>
<input type="submit" name="more_loc" value="Send Data" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
but it display both tables on the same page and doesnt send data to the mysql database.