Page 1 of 1

post option, foreach, session arrays problem

Posted: Mon May 24, 2010 10:56 am
by nitediver
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.

Re: post option, foreach, session arrays problem

Posted: Mon May 24, 2010 12:47 pm
by markusn00b
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

Posted: Tue May 25, 2010 2:18 am
by nitediver
Sorry, Im sleepy and tired.
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>";
?>
2.How to set parameter for foreach in 3.php, since Im sending two variable($id & $size)?

Code: Select all

foreach($_SESSION['cart'] as $id => $q){

Re: post option, foreach, session arrays problem

Posted: Tue May 25, 2010 10:24 am
by Jonah Bron
Still not quite understanding the question. Do you mean you want to carry over some data with a session?