Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

drop down passing value to next page

Status
Not open for further replies.

haslamjd

IS-IT--Management
Oct 26, 2007
8
US
I have a dreamweaver8 form with a drop down menu that is populated with dynamic data from my database. The recordset (rs_findrecord) has two pieces of data, the id (value) and the domain name (option). The form population part is working fine. But once you select one of the records from the drop-down menu list that is created, and hit the submit button, it is suppose to pass the value parameter of the selected option on to the next page in the URL. Which it kind of does, except that it is only passing the value of the first option in the list (which value is 219) and not the value of the option that was selected.

This is the actual url that is being currently being passed but has the wrong value for the id parameter:

I need the value of the option selected to be passed. Everything else should work once I get that to send the right value. Thanks for any help you might offer.
----------------------------------
Here is the form's code that dreamweaver has made so far:


<form action="find_domain_results.php?id=<?php echo $row_rs_findrecord['id']; ?>" method="post" name="form2" target="_blank" id="form2">
<div align="left">
<p><strong>Select from this list:</strong>
<select name="select">
<option value="">-- Select Domain Name Below --</option>
<?php
do {
?>
<option value="<?php echo $row_rs_findrecord['id']?>"><?php echo $row_rs_findrecord['Domain Name']?></option>
<?php
} while ($row_rs_findrecord = mysql_fetch_assoc($rs_findrecord));
$rows = mysql_num_rows($rs_findrecord);
if($rows > 0) {
mysql_data_seek($rs_findrecord, 0);
$row_rs_findrecord = mysql_fetch_assoc($rs_findrecord);
}
?>
</select>
<input type="submit" name="Submit" value="Get It" />
</p>
</div>
</form>
 
I am rusty but it seems like you got two approaches crossed:
search/google for "passing variables using URL" vs. "requesting variable from forms"

sorry no php markup skills to give u a correction.
forum action should be just the page
<form action="find_domain_results.php">
and on that page you request a form variable and use that var to filter RS by it...
u can test it on find_domain_results.php by simply using request and echo...
All the best!

:--------------------------------------:
fugitive.gif


All around in my home town,
They tryin' to track me down...
|MostarNetworks|
 
You seem to have a confusion or form methods.

Your form uses POST as its method, yet you expect the value of the select box to be in the URL. that's never gonna happen. POST just doesn't do that.

And Adding a call to the $row variable will only make the last value that variable has to be placed there.

I'm thinking what you want to do is remove that part from the forms action so its just find_domain_results.php and change your form's method to GET, instead of POST. then you should see the value in the url when you submit the form, as ?select=some_value.





----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top