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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Locate a drop down list on a form and using it to submit data

Status
Not open for further replies.

likelylad

IS-IT--Management
Jul 4, 2002
388
GB
I have obtained the following code for producing a drop down list, which works perfect for me.

<?php
$result = mysql_query(&quot;SELECT drop_down FROM database&quot;,$db);

echo &quot;<select name=drop_down>\n&quot;;
while ($row = mysql_fetch_array($result)) {
echo &quot;<option value=$row[0]>$row[0]</option>\n&quot;;
}
echo &quot;</select>\n&quot;;
?>


First of all, what I would like to do is to locate this drop down box in a particular location.
At the moment I am using the following to locate text boxes on the page

<div id=&quot;Layer1&quot; style=&quot;position:absolute; left:10px; top:125px; width:100px; height:37px; z-index:1&quot;>
First name:<input type=&quot;Text&quot; name=&quot;first&quot;><br><br>
</div>



Second of all, how do I incorporate this dropdown box into my form, such that when I hit the submit button it will send the selected option to the database.

Please Note :I already have a form that will send data to a database

Thanking in advance for any help received
 
Hi

I have figured out how to position the dropdown box on the page.
The last thing I need help with, is how to incorporate the selected information from the drop down box into the form such that when it will transmit the data when the submit button is pressed.

 
If you are using POST on your form, then you can access all the variables from the $_POST array, and for GET use $_GET.

If you want to see all your POST data quickly, use print_r($_POST); --BB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top