Jump to content

Returnin Database Values from Form Submission


Mewsta

Recommended Posts

Hi Guys, I am a newbie to PHP so please bear with me.

 

I have a page containing 3 Combo boxes. The data in these combo boxes is pulled from tables in MySQL.

 

I also have 3 tables containing Origins, Destinations & Prices for this depending on containder size. So if a 20ft Container is selected then the process.php file looks at the table named tbl_freights_20ft, matches the origin (ie Hong Kong), matches the destination (ie Southampton) and returns the price for the shipment.

 

I have no idea where to start with this so any help is much appreciated.

 

Here is the code for my selection page:

 

<select name=origin> 
<?php 
$result = mysql_query("SELECT * FROM tbl_origin ORDER BY origin"); 

$combo = "SELECT DISTINCT(origin) FROM tbl_origin"; 
$res = mysql_query($combo) or die(mysql_error()); 
while($origin = mysql_fetch_assoc($res)){ 
echo "<option value=\"".$origin['id']."\">".$origin['origin']."</option>\n"; 
} 
?> 
</select> 
</td> 
</tr> 
<tr> 
<td height="5"></td> 
</tr> 
<tr> 
<td align="right" width="390"><font face="verdana" size="2" color="#005696">Destination</font></td> 
<td width="10"></td> 
<td align="left" width="390"> 
<select name=destination> 
<?php 
$result = mysql_query("SELECT * FROM tbl_destinations ORDER BY destination"); 

$combo = "SELECT DISTINCT(destination) FROM tbl_destinations"; 
$res = mysql_query($combo) or die(mysql_error()); 
while($dest = mysql_fetch_assoc($res)){ 
echo "<option value=\"".$dest['id']."\">".$dest['destination']."</option>\n"; 
} 
?> 
</select>

I want to query a table depending on container size selected from a drop down box.

 

So if a 20ft Container was selected, it would query tbl_freights_20ft then it would look at the user selection of Origin and Destination match these fields within the same table and return the price for this selection.....

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.