This small part of the PHP code is not working for some reason ... I need a little

help , THANKS !!!? What the PHP is supposed to do is retrieving the values from the HTML form according to the area code that it belongs to and COMPUTE the price of shipping per pound because each area code has its own price for shipment .. It works to display the price of the area code BUT the it doesn't compute HOW MUCH it is going to cost in total if you enter the weight on the form ... Thanks a lot !!

So here is what I have done

Here is the FORM code

<html>
<head> <title> form </title> </head>
<body>
<h1> Please select a status code or enter a bank balance </h1>




<form action="region.php" method="post">



Enter area code : *
<input type="text" name="areacode" size="20" /> <br />

Enter weight : *
<input type="text" name ="weight" size = "20" /> <br />



<input type="submit" value="Check status" />
<input type="reset" value="Clear form" />

</body>
</html>

Here is the PHP CODE


<html>
<head> <title> Change Cash Calculator </title> </head>
<body>

<html>
<head> <title> Change Cash Calculator </title> </head>
<body>

<?php


$areacode = $_POST['areacode'];
$weight =$_POST['areacode'];



if ($areacode == 508 || $areacode == 617 || $areacode == 413)
{

$switchcase =1;

}
if($areacode == 207 || $areacode == 603 || $areacode == 802)
{

$switchcase =2;
}

if ( $areacode == 404 || $areacode ==706 || $areacode == 803)
{

$switchcase =3;

}




switch($switchcase)

{

case 1:


echo " The price of the following location is going to be : $2.50 per pound ";

break;


case 2:

echo " The price of the following location is going to be : $ 3.50 per pound";

break;


case 3:

echo "The price of the following location is going to be : $ 5.00 per pound";

}


if ($areacode == 508 || $areacode == 617 || $areacode == 413)

{

echo " So the cost is going to be ";

2.50 * $weight;
}

if($areacode == 207 || $areacode == 603 || $areacode == 802)

{

echo "so the cos is going to be";

3.50 * $weight;

}



if ( $areacode == 404 || $areacode ==706 || $areacode == 803)

{

echo " so the cost is going to be ";

5 * $weight;
}


?>


</body>

</html>


and here is the OUTPUT .. So it doesn't give me the cost , which I have already programmed to be included as well... what is wrong with my code ?

The price of the following location is going to be : $2.50 per pound So the cost is going to be
 
Back
Top