My problem is:
1.The value from drop down list did not post, should I post it on 1.php using if(isset..., & redirect,
or
using "$size_id = $_SESSION['size_id'] = htmlentities($_POST['size_id'], ENT_QUOTES);" on 2.php
2.How to deal with this "foreach($_SESSION['cart'] as $id => $q){" on 3.php, since it carry 2 value(id & size)?
Thank you, any advice will be appreciate.
post option, foreach, session arrays problem
Moderator: General Moderators
post option, foreach, session arrays problem
Last edited by nitediver on Wed Jun 09, 2010 7:27 am, edited 1 time in total.
- markusn00b
- Forum Contributor
- Posts: 298
- Joined: Sat Oct 20, 2007 2:16 pm
- Location: York, England
Re: post option, foreach, session arrays problem
Can you post the relevant pieces of code for each question. It's too much like hard work trying to figure it out myself. Also, slightly more elaborate questions would be a plus.
Re: post option, foreach, session arrays problem
Sorry, Im sleepy and tired.
1.I mean how to post selected value from drop down list in 2.php?
2.How to set parameter for foreach in 3.php, since Im sending two variable($id & $size)?
1.I mean how to post selected value from drop down list in 2.php?
Code: Select all
<?php
echo $qprod['name'];
echo "<select name=\"size\">";
while($row = mysql_fetch_array($qsize)){
echo "<option value=\"$row[size_id]\">$row[size_number]</option>";
}
echo "</select>";
?>
Code: Select all
foreach($_SESSION['cart'] as $id => $q){- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
Re: post option, foreach, session arrays problem
Still not quite understanding the question. Do you mean you want to carry over some data with a session?