Jump to content

[SOLVED] Variable Pass to next Page?


ainoy31

Recommended Posts

Hello-

 

I need a second eye my code.  I have a drop menu and if someone selects "Other", then a new input text field pops up asking to type their value.  Here is the code to do so:

 

<td>Unit Type:</td>
		<td>
			<select name="pieces_type" onchange="toggleOther( document.form1.pieces_type.options[ document.form1.pieces_type.selectedIndex ].value );">
			<option value="">-Select One-</option>
			<option value="Pallets">Pallets</option>
			<option value="Packages">Packages</option>
			<option value="Totes">Totes</option>
			<option value="Other_Air">Other - Specify</option>
			</select>
			<input type="text" name="Other_Air" value="" size="25" maxlength="40" style="visibility:hidden" />
		</td>

 

I am passing this info to the next page.

 

$pt1 = $_POST["pieces_type"];

if($pt1 == 'Other_Air')
{
	$pt3 = $_POST["Other_Air"];
}
if($pt1 != 'Other_Air')
{
	$pt3 = $_POST["pieces_type"];	
}

echo "Type of Units: " . $pt3 . "<br>";

 

My issue is that if I select Other - Specify and enter my value, it does not get pass properly to the next page.  I get the value of Other_Air instead of what I entered say Crates.  I am probably overlooking something stupid but been up for 26 hrs now.  Much appreciation.  AM

Link to comment
https://forums.phpfreaks.com/topic/82383-solved-variable-pass-to-next-page/
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.