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'];

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.