Dear All,
I have 3 forms all located in 1 page. The code is below. All these 3 forms have got their form action pointing towards Untitled-3.php. The code of Untitled-3.php is also below.
Now here's what I want to achieve. I want each form to query different fields individually. Explained slightly differently, form1 should query the add_1 field, form2 should query the address field & form3 should query the price field. I've already got form1 to query the area_1 field successfully by using the code below:-
$query="SELECT * FROM average_income WHERE (area_1 like '%$frmarea_1%')";
Now how do I get form2 & form3 working?
I'm a newbie to php so please be patient with me.
Thanks.
The code for the forms:-
<head>
<title>Untitled Document</title>
</head>
<body>
<form name="form1" method="POST" action="Untitled-3.php">
<p>
<table cellspacing="0" cellpadding="0">
<col width="64" span="3">
<tr height="17">
<td width="64" height="17">Area</td>
<td width="64"></td>
<td width="64"><input name="area_1" type="text" id="area_1"></td>
</tr>
<tr height="17">
<td height="17"></td>
<td></td>
<td></td>
</tr>
</table>
<p>
<input name="submit" type="submit" id="submit" value="Submit">
</form>
<form name="form2" method="POST" action="Untitled-3.php">
<table cellspacing="0" cellpadding="0">
<col width="64" span="3">
<tr height="17">
<td width="64" height="17">Address</td>
<td width="64"></td>
<td width="64"><input name="address2" type="text" id="address2"></td>
</tr>
<tr height="17">
<td height="17"></td>
<td></td>
<td></td>
</tr>
</table>
<p>
<input name="submit2" type="submit" id="submit2" value="Submit">
</form>
<form name="form3" method="POST" action="Untitled-3.php">
<table cellspacing="0" cellpadding="0">
<col width="64" span="3">
<tr height="17">
<td width="64" height="17">Price</td>
<td width="64"></td>
<td width="64"><input name="price3" type="text" id="price3"></td>
</tr>
<tr height="17">
<td height="17"></td>
<td></td>
<td></td>
</tr>
</table>
<p>
<input name="submit3" type="submit" id="submit3" value="Submit">
</form>
<p> </p>
</body>
</html>
The code for Untitled-3.php:-
<head>
<title>Untitled Document</title>
</head>
<body>
<?php
import_request_variables("gP", "frm");
if ($frmarea_1 == '') $frmarea_1 = '0';
if ($frmaddress == '') $frmaddress = '0';
if ($frmprice == '') $frmprice = '0';
$username="abc123";
$password="abc123";
$database="abc123";
$host="localhost";
mysql_connect ("$host","$username","$password");
mysql_select_db($database) or die( "Where's the database man?");
$query="SELECT * FROM average_income WHERE (area_1 like '%$frmarea_1%')";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
?>
<table border="0" cellspacing="2" cellpadding="2">
<tr>
<th><font face="Arial, Helvetica, sans-serif">Area</font></th>
<th><font face="Arial, Helvetica, sans-serif">Address</font></th>
<th><font face="Arial, Helvetica, sans-serif">Price</font></th>
</tr>