Hello, I was wondering how I could post the value from a drop down menu into my form? Thanks in advance
<select name="radio1" style="font-size:10px;"> <option value="none" selected>
<option value="RAM-B-138">ABLE2 - 05-5300 (3")
<option value="RAM-B-137">ABLE7 - 05-5300 (7")
</select>
<?php if ($radio1=="none")
echo '';
else
echo '<span class="contentred">Radio/Control Head/Switch 1: ', $radio1, '</span><br>
<form name="CartItem" action="https://www.ram-mount.com/RamCart/aCartPutItem.php" method="POST" target="myIFrame">
<input type="hidden" name="part" value="$radio1"><input type="submit" value="Add To Cart">
</form>
how to retrieve value from drop down list
Moderator: General Moderators
-
tonyledenko
- Forum Newbie
- Posts: 15
- Joined: Thu Sep 11, 2008 4:22 pm
Re: how to retrieve value from drop down list
- $radio1 needs a value. If you don't have one already you need a $radio1=$_POST["radio1"] beforehand.
- The last echo statement uses single quotes. Variables don't get interpolated and you'll see them in the output.
The first time you use $radio1 there is correct: do the same thing with the second time.
- Printing data from a form can be dangerous. Instead of using $radio1 directly use htmlentities($radio1) like
- The last echo statement uses single quotes. Variables don't get interpolated and you'll see them in the output.
The first time you use $radio1 there is correct: do the same thing with the second time.
- Printing data from a form can be dangerous. Instead of using $radio1 directly use htmlentities($radio1) like
Code: Select all
echo '<span class="contentred">Radio/Control Head/Switch 1: ', htmlentities($radio1), '</span><br>...'-
tonyledenko
- Forum Newbie
- Posts: 15
- Joined: Thu Sep 11, 2008 4:22 pm
Re: how to retrieve value from drop down list
Im sorry - I would like to value to be posted in the form.
<input type="hidden" name="part" value="$radio1">
Thanks for your help
<input type="hidden" name="part" value="$radio1">
Thanks for your help
Re: how to retrieve value from drop down list
tasairis wrote:- The last echo statement uses single quotes. Variables don't get interpolated and you'll see them in the output.
The first time you use $radio1 there is correct: do the same thing with the second time.
-
tonyledenko
- Forum Newbie
- Posts: 15
- Joined: Thu Sep 11, 2008 4:22 pm
Re: how to retrieve value from drop down list
Thank You!!!!!!!!!!!!!!!!!!!!!!!!!!! It worked.