Jump to content

Passing a variable from a drop down in a form


alicefreak

Recommended Posts

Ok here is what im trying to do:

1. drop down list pulled from mysql database.( working )

2. after you select the name in the drop down list

3. Use selected name to another page.

here is code

 

 

<?php
include('include/db_connection.inc');

$table = "truck_master";

$result = mysql_query( "SELECT driver_name FROM $table" );

$options=""; 
while ($row=mysql_fetch_array($result)) {

$driver_name=$row["driver_name"];

$options.="<OPTION VALUE=\"driver_name\">".$driver_name.'</option>';




} ?>
<html>
<head>
</head>
<body>
<table align="center">

<form name="form1" method="GET" align="center" action="issue.php">

<tr>
	<td>Driver Name :</td>
	<td><SELECT name="driver_name"><OPTION VALUE=''>Choose<?php echo $options?></SELECT> </td>
</tr>
<tr>
	<td><input type="submit" name="Submit" value="Submit"> </td>
</tr>
</form>
	</table>
</body>
<html>

Second Code IS

$driver = $_GET['driver_name'];

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.