if I want to make this script:
<html>
<body>
<table border = 0 cellpadding = 3>
<tr>
<td bgcolor = "#CCCCCC" align = center>Distance</td>
<td bgcolor = "#CCCCCC" align = center>Cost</td>
</tr>
<?
$distance = 50;
while ($distance <= 250 )
{
echo "<tr>\n <td align = right>$distance</td>\n";
echo " <td align = right>". $distance / 10 ."</td>\n</tr>\n";
$distance += 50;
}
?>
</table>
</body>
</html>
Display the Cost side dynamically using the get function to get the type of shipping which will be passed through ther url. So say I want to divide the $distance by $ship, but $ship will have different prices depending on the type of shipment the user choose; overnight, 2nd day, ground. so the url would be something like:
http://yoursite.com/shipcost.php?ship=ground
and depending on that you can caluate the total cost for shipping. What I am confused about is I thought I would be able to use the IF and ELSE IF, but I got stuck there. I hope you can help me out, thanks! Below is a copy of what I imagine the form of the script sould be, but Im pretty sure im wrong!
<html>
<body>
<table border = 0 cellpadding = 3>
<tr>
<td bgcolor = "#CCCCCC" align = center>Distance</td>
<td bgcolor = "#CCCCCC" align = center>Cost</td>
</tr>
<?
$ship = $GET_['ship'];
if( $ship == ground )
{
$ship == 15;
}
elseif( $ship == 2ndDAY )
{
$ship == 10;
}
elseif( $ship == overnite)
{
$ship == 5;
$distance = 50;
while ($distance <= 250 )
{
echo "<tr>\n <td align = right>$distance</td>\n";
echo " <td align = right>". $distance / $ship ."</td>\n</tr>\n";
$distance += 50;
}
?>
</table>
</body>
</html>
Thanks in advanced! =)