rogerzebra
Technical User
Hi all,
I definately need someone to help me I'm pretty new to this so please have patience. I'm trying to find out on how to retrive information from a database depending of what selected option you have made in a listform.
I have a form_layout.html page including the listbox with several options in it and a submit button and a select_it.php page with the database connection and a query on what to select. When i submit the button on the html page it shows me the whole table information wich was not a supprise but that is not what I want it to do. I want it to show me the information based on what option you've made in the listbox showing me the result for that specific row (producer info) pulled out from the database. I know that my basic script is far from what I want, so please can anyone help me with this.
This is my code
<form name="form1" method="post" action="select_it.php">
<p align="center">
<select name="Producers" size="1" id="Producers">
<option value="Alcott Insurance Services">Alcott Insurance Services</option>
<option value="Owen-Dunn Insurance">Owen-Dunn Insurance</option>
<option value="Pehaim & Snipper Ins Svc Inc">Pehaim & Snipper
Ins Svc Inc</option>
<option value="Dwight Gove Agency Inc">Dwight Gove Agency Inc</option>
etc..
</select>
<br>
<br>
<br>
<input type="submit" name="Submit" value="Submit">
<br>
</p>
<p> </p>
</form>
select_it.php page
<?php
// connect to server, database, table.
include 'db_intranet.php';
// retrieve the new information from the database
$result = mysql_query("SELECT * FROM producers");
while ($row = mysql_fetch_array($result)) {
print $row['producer_code'].','.$row['company_name'].','.$row['contacts_1'].'<br>';
}
?>
I hope my explaination is clear and understandable.
Thank you in advance
/rz
I definately need someone to help me I'm pretty new to this so please have patience. I'm trying to find out on how to retrive information from a database depending of what selected option you have made in a listform.
I have a form_layout.html page including the listbox with several options in it and a submit button and a select_it.php page with the database connection and a query on what to select. When i submit the button on the html page it shows me the whole table information wich was not a supprise but that is not what I want it to do. I want it to show me the information based on what option you've made in the listbox showing me the result for that specific row (producer info) pulled out from the database. I know that my basic script is far from what I want, so please can anyone help me with this.
This is my code
<form name="form1" method="post" action="select_it.php">
<p align="center">
<select name="Producers" size="1" id="Producers">
<option value="Alcott Insurance Services">Alcott Insurance Services</option>
<option value="Owen-Dunn Insurance">Owen-Dunn Insurance</option>
<option value="Pehaim & Snipper Ins Svc Inc">Pehaim & Snipper
Ins Svc Inc</option>
<option value="Dwight Gove Agency Inc">Dwight Gove Agency Inc</option>
etc..
</select>
<br>
<br>
<br>
<input type="submit" name="Submit" value="Submit">
<br>
</p>
<p> </p>
</form>
select_it.php page
<?php
// connect to server, database, table.
include 'db_intranet.php';
// retrieve the new information from the database
$result = mysql_query("SELECT * FROM producers");
while ($row = mysql_fetch_array($result)) {
print $row['producer_code'].','.$row['company_name'].','.$row['contacts_1'].'<br>';
}
?>
I hope my explaination is clear and understandable.
Thank you in advance
/rz