Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get Session Array Information

Status
Not open for further replies.

likelylad

IS-IT--Management
Jul 4, 2002
388
GB
I have the following information stored in a session

Code:
Array ( [counter] => 5 [product] => Array ( [1] => PR1 [2] => PR2 [3] => PR3 [4] => PR4 [5] => PR5  ) )

I am then using this information to produce a list of products on a web page. This code is shown below:

Code:
foreach ($_SESSION["product"] as $value)
 {
echo $value;
?>

<a href="page.php?productkey=[COLOR=#ff0000]?????[/color]&product=<?php echo $value ?>" target="rightpane" onclick="window.open(this.href, this.target).focus(); return false;" style="width:150"><img src="images/remove.gif" border="0"></a>
<?php
}
?>

What I would be able to do is to put the right information into the ????? section.

I want to show:
page.php?productkey=1&product=PR1
page.php?productkey=2&product=PR2
page.php?productkey=3&product=PR3
etc

I hope this is clear???????

Thanking in advance for any help received.
 
Sorry figured it out

solution was to change
Code:
foreach ($_SESSION["product"] as $key => $value)

And

Code:
<a href="page.php?productkey=php echo $key ?>&product=<?php echo $value ?>" target="rightpane" onclick="window.open(this.href, this.target).focus(); return false;" style="width:150"><img src="images/remove.gif" border="0"></a>
 
Code:
<a href="page.php?productkey=[COLOR=red]<?[/color]php echo $key ?>&product=<?php echo $value ?>" target="rightpane" onclick="window.open(this.href, this.target).focus(); return false;" style="width:150"><img src="images/remove.gif" border="0"></a>

--
Tek-Tips Forums is Member Supported. Click Here to donate

<honk>*:O)</honk>

Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top