0

I am needing a dropdown menu to pull data from table on a mysql database and then with the selected item, send it to a new table along with the rest of the data from the form.

I have got the dropdown pulling data from the database with the following code:

<?php
$con = mysql_connect($sqlserver,$sqluser,$sqlpassword);
if (!$con)
{
die('Connection to SQL Server failed. Error:   ' . mysql_error());
}
mysql_select_db($sqldb, $con);
$result = mysql_query("SELECT functions FROM functions");
echo "<SELECT id=\'func\' name=\'func\' multiple=\'multiple\'>";
						
						if (mysql_num_rows($result)>0)
						{
								while($row=mysql_fetch_array($result))
							{
								echo "<option value=\'$row[functions]\'>$row[functions]</option>";
							}
						}
						echo "</SELECT>";
						mysql_close($con)
					?>

Which works fine,

however I am totally baffled as to how i get it to send with the form. Is there something im missing here?

Cheers.

Edited by jakizak: n/a

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by chrishea
0

btw sorry for the code scatter there no idea how that happened.

0

You haven't defined a form! Before you start generating Select and Option statements, you need to define a form (<form action=xxxx, method=post>) where xxxx is the module that will receive the form output (it will default to the same module that creates the form). At the very end, you will want to add a submit button and a closing </form>.

If you aren't familiar with forms, then do a search and read some tutorials.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.