Help needed to POST values
Posted: Tue Feb 12, 2013 11:34 am
I have some problems with this code.
I'm trying to POST some values from the Select box and the Options to another page called "cart.php"
Here is the code:
-------------------------------
In the cart.php I have this code:
--------------------------------
I'm able to get the value from $_POST['pid'], but the other two values gives me nothing.
Can any one of you tell me what i'm doing wrong!
Regards Benny
I'm trying to POST some values from the Select box and the Options to another page called "cart.php"
Here is the code:
Code: Select all
<form id="form1" name="form1" method="post" action="cart.php" target="_self">
<select name="sizetable" id="sizetable">
<option value="<?php echo $size_1?>"><?php echo $size_1?></option>
<option value="<?php echo $size_2?>"><?php echo $size_2?></option>
<option value="<?php echo $size_3?>"><?php echo $size_3?></option>
<option value="<?php echo $size_4?>"><?php echo $size_4?></option>
</select>
<input type="option" name="colsel" id="color_white" value="Hvid"/>
<input type="option" name="colsel" id="color_black" value="Sort"/>
<input type="option" name="colsel" id="color_grey" value="Grå" />
<input type="option" name="colsel" id="color_lightred" value="Lys Rød";/>
<input type="option" name="colsel" id="color_red" value="Rød" />
<input type="option" name="colsel" id="color_pink" value="Pink" />
<input type="option" name="colsel" id="color_blue"value="Blå" />
<input type="option" name="colsel" id="color_lightblue" value="Lys Blå" />
<input type="option" name="colsel" id="color_green" value="Grøn" />
<input type="option" name="colsel" id="color_lime" value="Lime" />
<input type="option" name="colsel" id="color_yellow" value="Gul" />
<input type="option" name="colsel" id="color_orange" value="Orange" />
<input type="option" name="colsel" id="color_purple" value="Lilla" />
<input type="option" name="colsel" id="color_silver" value="Sølv" />
<input type="option" name="colsel" id="color_gold" value="Guld" />
<!--</form>-->
<!-- <div style=" z-index:100;position: absolute; left: 620px; top: 0px; width: 154px; height: 38px;" align="right"> -->
<input type="hidden" name="pid" id="pid" value="<?php echo $id; ?>" />
<input type="hidden" name="sizetable" id="sizetable" value="<?php echo $size_1; ?>" />
<input type="hidden" name="colsel" id="colsel" />
<input type="image" name="imageField" id="imageField" src="siteimages/legikurv.png" title="Læg varen i indkøbskurver" />
</form>In the cart.php I have this code:
Code: Select all
if (isset($_POST['pid'])) {
$pid = $_POST['pid'];
$pd = $_POST["sizetable"];
$pd1 = $_POST["colsel"];
}I'm able to get the value from $_POST['pid'], but the other two values gives me nothing.
Can any one of you tell me what i'm doing wrong!
Regards Benny