Hi!! I know the question look weird but this is what I want to do.
I have to dropdown witch I pass an sql query to populate it. my problem is I really don't know how to pass the value to my search.php
you can made a test by going here
and chose 1/24 from the first drop down, nissan from the second and put 24161 in the text field. clic submit and VOILA... the missing info are the scale and the vehicule manufacture.. because variables are not assign to the dropdown. so HOW I can do that??? and how my code will change in the search.php??
this is my form...
THIS IS THE SEARCH.PHP
THASNK YOU VERY MUCH FOR YOUR HELP
sebastien
I have to dropdown witch I pass an sql query to populate it. my problem is I really don't know how to pass the value to my search.php
you can made a test by going here
and chose 1/24 from the first drop down, nissan from the second and put 24161 in the text field. clic submit and VOILA... the missing info are the scale and the vehicule manufacture.. because variables are not assign to the dropdown. so HOW I can do that??? and how my code will change in the search.php??
this is my form...
Code:
<?php
include_once("db_connection.php");
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Search engine</title>
</head>
<p><body>
<table width="920" border="0">
<tr>
<td width="524"><p class="style5"><br />
<table width="920" border="0"><tr><td width="39" align="right"><table width="920" border="0">
<tr>
<td><?php // start of dropdown
$sql = mysql_query("SELECT DISTINCT scale FROM kit ");
$options = '';
echo '<select scale="scale"><option>Scale</option>';
while($row = mysql_fetch_array($sql)) {
$thing = $row['scale'];
echo '<option>'.$thing.'</option>';
}
echo '</select>';
// end of dropdown ///?></td>
<td><div align="left">
<?php // start of drop down ///
$sql = mysql_query("SELECT DISTINCT manufacturer_reel FROM kit ORDER BY manufacturer_reel");
$options = '';
echo '<select manufacturer_reel="manufacturer_reel"><option>Reel manufacturer</option>';
while($row = mysql_fetch_array($sql)) {
$thing = $row['manufacturer_reel'];
echo '<option>'.$thing.'</option>';
}
echo '</select>';
// end of dropdown ///?>
</div></td>
</tr>
<tr>
<td colspan="2"><h1 align="center">Model kit database</h1>
<p align="center">You may search either by vehicule's year of fabrication , kit manufacturer or kit number*</p>
<form method="post" action="search.php?go" id="searchform">
<div align="center">
<input type="text" name="name" />
<input type="submit" name="submit" value="Search" />
</div>
</form></td>
</tr>
</table></td>
</table>
<br>
<table width="920" border="0">
<tr>
<td><h4 align="center"><strong>* don't put any hyphen " - " in the kit number.
Ex: usually revell number are 85-2654. here put 852654</strong></h4>
</td>
</tr>
</table>
Code:
<?php
include_once("db_connection.php");
if(isset($_POST['submit'])){
if(isset($_GET['go'])){
if(preg_match("/^[ a-zA-Z0-9]+/", $_POST['name'])){
$name=$_POST['name'];
//-query the database table for the post field
$sql="SELECT kit_id, kit_number, kit_name, description, manufacturer_kit, engine_detail, year_prod_kit, year_prod_reel, image_id, image_id1, image_id2 FROM kit WHERE kit_number LIKE '%" . $name ."%' OR kit_name LIKE '%" . $name . "%' OR description LIKE '%" . $name . "%' OR manufacturer_kit LIKE '%" . $name . "%' OR year_prod_reel LIKE '%" . $name ."%'";
//-run the query against the mysql query function
$result=mysql_query($sql);
//-make the header of the table
echo " <table align=center width=\"1255\" border=\"\">\n";
echo " <tr>\n";
echo" <td nowrap align=center width='95'> kit manufacturer \n";
echo" <td nowrap align=center width='55'> scale \n";
echo" <td nowrap align=center width='90'> kit number \n";
echo" <td nowrap align=center width='290'> kit name \n";
echo" <td nowrap align=center width='400'> description \n";
echo" <td nowrap align=center width='95'> vehicule manufacturer \n";
echo" <td nowrap align=center width='75'> year of reel production of car \n";
echo" <td nowrap align=center width='75'> complete engine detail\n";
echo" <td nowrap align=center width='75'> Select Picture to get bigger\n";
echo" <td nowrap align=center width='75'> instruction sheet\n";
echo" <td nowrap align=center width='50'> box contain\n";
echo " <tr>\n";
//-create while loop and loop through result set
while($row=mysql_fetch_array($result)){
$description =$row['description'];
$manufacturer_kit=$row['manufacturer_kit'];
$kit_id=$row['kit_id'];
$kit_number=$row['kit_number'];
$kit_name=$row['kit_name'];
$engine_detail=$row['engine_detail'];
$year_prod_reel=$row['year_prod_reel'];
$image_id=$row['image_id'];
$image_id1=$row['image_id1'];
$image_id2=$row['image_id2'];
//-create table of item during he while loop
echo " <table align=center width=\"1255\" border=\"\">\n";
echo" <td nowrap align=center width='95'> $manufacturer_kit \n";
echo" <td nowrap align=center width='90'> $kit_number \n";
echo" <td nowrap align=center width='290'> $kit_name \n";
echo" <td nowrap width='400'> $description \n";
echo" <td nowrap align=center width='75'> $year_prod_reel \n";
echo" <td nowrap align=center width='75'> $engine_detail \n";
echo" <td nowrap width='75'> <a href=".$image_id."> <img src='".$image_id."' width='75' height='50' border='0'/>";
echo" <td nowrap width='75'> <a href= ".$image_id1."> <img src= 'http://www.scale24-25.com/images/PDF_logo.gif' width='50' height='50' border='0'/>";
echo" <td nowrap width='50'> <a href=".$image_id2."> <img src='http://www.scale24-25.com/images/PDF_logo.gif' width='50' height='50' border='0'/>";
echo " </tr>\n";
echo " </table>\n";
echo " </tr>\n";
echo " </table>\n";
}
}
else{
echo "<p>Please enter a search query</p>";
}
}
}
?>
sebastien
Comment