sanjdhiman
Programmer
I have the following code
<?
echo "<form action=$PHP_SELF?companyname=\"$agentcompany\" method=\"post\" name=\"deleteagent\">";
?>
<tr>
<td width=30% class="form">Choose by Company Name:</td>
<td width=100% class="form"><select name="agentcompany" onChange="javascript:submit()">
<option value="none">Select</option>
<?
$conn=db_connect();
$query = "SELECT CompanyName FROM estateagent";
$result = mysql_query($query);
if (mysql_num_rows($result) >0)
$num_results = mysql_num_rows($result);
for ($i=0; $i <$num_results; $i++)
{
$row = mysql_fetch_array($result);
$companyname=$row["CompanyName"];
echo "<option value=\"$companyname\"> $companyname </option>";
}
?>
</select>
What i would like to do is that once a person clicks on the dropdown select box it re-evaluates the page and submits itself, and runs a function called
showagentdetails($companyname)
based on the value in the drop down.
I understand that if the SELECT box is geneated by PHP it doesnt evaluate the page everytime..
IS there away to get round this at all?
Regards and thanks in advance
Sanj
<?
echo "<form action=$PHP_SELF?companyname=\"$agentcompany\" method=\"post\" name=\"deleteagent\">";
?>
<tr>
<td width=30% class="form">Choose by Company Name:</td>
<td width=100% class="form"><select name="agentcompany" onChange="javascript:submit()">
<option value="none">Select</option>
<?
$conn=db_connect();
$query = "SELECT CompanyName FROM estateagent";
$result = mysql_query($query);
if (mysql_num_rows($result) >0)
$num_results = mysql_num_rows($result);
for ($i=0; $i <$num_results; $i++)
{
$row = mysql_fetch_array($result);
$companyname=$row["CompanyName"];
echo "<option value=\"$companyname\"> $companyname </option>";
}
?>
</select>
What i would like to do is that once a person clicks on the dropdown select box it re-evaluates the page and submits itself, and runs a function called
showagentdetails($companyname)
based on the value in the drop down.
I understand that if the SELECT box is geneated by PHP it doesnt evaluate the page everytime..
IS there away to get round this at all?
Regards and thanks in advance
Sanj