Jump to content

[SOLVED] Radio Button ?


ainoy31

Recommended Posts

Hello-

 

I am missing something simple here.  I have three radio buttons:

<form name="form1" action="nextpage.php" method="post">
<input type="radio" name="shipment_type" value="AIR"  onClick="hideAll(); changeDiv('air', 'block'); ">AIR
<input type="radio" name="shipment_type" value="LCL" onClick="hideAll(); changeDiv('lcl', 'block'); ">LCL
<input type="radio" name="shipment_type" value="FCL" onClick="hideAll(); changeDiv('fcl', 'block'); ">FCL
<input type="submit" name="submit" value="Submit"></form>

 

I am passing the data to  nextpage.php where I am checking to see if AIR, LCL or FCL was selected.  Base on my selection, I display the data for AIR, or the data for LCL...etc  Here is my code to do that:

$shipment_type = $_POST["shipment_type"] . "<br>";
if($shipment_type = "AIR")
{
$piece_type1 = $_POST["pieces_type"];
if($piece_type1 == "Other1")
{
	$piece_type1 = $_POST["Other1"];
}
else
{
	$piece_type1 = $_POST["pieces_type"];	
}
echo "Shipment Type: " . $shipment_type . "<br>";
echo "Type of Pieces: " . $piece_type1 . "<br>";
echo "Shipper Known: " . $value = $_POST["known_shipper"]. "<br>";
echo "Total Dimensional in Cubic Inches: " . $dim_in = $_POST["cubicinches1"] . "<br>";
echo "Dimensional Weight in Kgs: " . $wgt = $_POST["dim_wgt1"] . "<br>";
echo "Actual Total Weight in Kgs: " . $d = $_POST["result1"] . "<br>";
echo "Chargeable Weight in Kgs: " . $c = $_POST["charge_wgt1"] . "<br>";
echo "Total Pieces: " . $np = $_POST["numpiece_1"]. "<br>";
echo "<br><br>";
}
if($shipment_type = "LCL")
{
$piece_type2 = $_POST["pieces_type1"];
if($piece_type2 == "Other2")
{
	$piece_type2 = $_POST["Other2"];
}
else
{
	$piece_type2 = $_POST["pieces_type1"];	
}
echo "Shipment Type: " . $shipment_type . "<br>";
echo "Type of Pieces: " . $piece_type2 . "<br>";
echo "Total Dimensional in Cubic Inches: " . $dim_in = $_POST["cubicinches2"] . "<br>";
echo "Dimensional Weight in CBM: " . $wgt = $_POST["dim_wgt2"] . "<br>";
echo "Actual Total Weight in KGS: " . $d = $_POST["result2"] . "<br>";
echo "Total Metric Ton: " . $mt = $_POST["mt"] . "<br>";
echo "Chargeable Weight: " . $c = $_POST["charge_wgt2"] . " " . $l = $_POST["label"] . "<br>";
echo "Total Pieces: " . $np = $_POST["numpiece_2"]. "<br>";
echo "<br><br>";
}

if($shipment_type = "FCL")
{
$piece_type3 = $_POST["pieces_type3"];
if($piece_type3 == "Other3")
{
	$piece_type3 = $_POST["Other3"];
}
else
{
	$piece_type3 = $_POST["pieces_type3"];
}
echo "Shipment Type: " . $shipment_type . "<br>";
echo "Type of Pieces: " . $piece_type3 . "<br>";
echo "Container Size: " . $con_size = $_POST["fcl_con_hgt"] . "<br>";
echo "Container Type: " . $con_type = $_POST["fcl_con_type"] . "<br>";
echo "Total Pieces: " . $np = $_POST["numpiece_3"]. "<br>";
echo "Total Dimensional in CBM: " . $dim_cbm = $_POST["tot_cbm"] . "<br>";
echo "Actual Total Weight in Kgs: " . $d = $_POST["result3"] . "<br>";

}

 

It does display the selected shipment type with it's data but also it displays the other two with empty values.  Much appreciation.  AM

Link to comment
https://forums.phpfreaks.com/topic/81066-solved-radio-button/
Share on other sites

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.