post option, foreach, session arrays problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nitediver
Forum Contributor
Posts: 109
Joined: Tue Feb 24, 2009 9:05 am

post option, foreach, session arrays problem

Post 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.
Last edited by nitediver on Wed Jun 09, 2010 7:27 am, edited 1 time in total.
User avatar
markusn00b
Forum Contributor
Posts: 298
Joined: Sat Oct 20, 2007 2:16 pm
Location: York, England

Re: post option, foreach, session arrays problem

Post 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.
nitediver
Forum Contributor
Posts: 109
Joined: Tue Feb 24, 2009 9:05 am

Re: post option, foreach, session arrays problem

Post 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){
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: post option, foreach, session arrays problem

Post by Jonah Bron »

Still not quite understanding the question. Do you mean you want to carry over some data with a session?
Post Reply