I have list of say 10 products on a page with a form field (used as quantity) as follows.
<input id="quantity" name="product[<?=$row1['sku'];?>]" type="text" size="2" maxlength="2" />
The user can enter the desired quantity of those products they are interested in, then the form post back to the same page. I want to populate the form field value="" with the value entered by the user. Usually done like this <?php echo $_POST['name'] ?>
But in this case the files names are like product[BGS-113468-001]
I have tried getting the values from the array as follows, but I can't seem to get it syntax right
I need help with the $val = lineCode:<input id="quantity" name="product[<?=$row1['sku'];?>]" type="text" size="2" maxlength="2" <?php if(isset($_POST['updateform'])){ //$val = $_POST['product']['.$row1['sku'].']; $val = "$_POST['product']['".$row1['sku']."']"; echo "value='".$val."'"; } ?> />
I try in 2 ways and get these errors
I get these respective errors
Parse error: syntax error, unexpected T_STRING, expecting ']' in ...
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING ...
Thanks







Bookmarks