I cannot use the URL and it looks like the foreach{} won't make the deal.
The reason why I can't use the URL is that the same page is loaded on every "submit",
plus the prices (which are session registered).
Maybe I should explain a bit more.
On a page, I have several products displayed.
The aim is to determine the price of each product, indenpendently from each other.
So, under each product, I have a form which end with:
print "<input type=\"submit\" value=\"Montrer le prix\" name=\"enter$i\">\n";
where $i is just anincrement.
So if the user tries to determine first the price of the second product, $enter2 will be set,
and then the price will be $price2.
This enables me to determine where to place the price on the template...
Right now, I am obliged to do it case by case as follows:
if(isset($enter1)) {
$price1 = $prix["price"];
session_register("price1");
}
elseif(isset($enter2)) {
$price2 = $prix["price"];
session_register("price2");
}
elseif(isset($enter3)) {
$price3 = $prix["price"];
session_register("price3");
}
... etc...
One of the reason for this is that I don't know how to loop the $enter value.
I would like to have something like:
if(isset($enter[$i])) {
$price[$i] = $prix["price"];
session_register("price[$i]");
}
Of course, the expression $enter[$i] doesn't work...
Then, to display the code, I have to do that kind of loop:
if(!isset($enter1) && $price1 && $i == '1') { ?>
<td class=normal><? print"$price1"; ?></td></tr>
<? }
if(!isset($enter2) && $price2 && $i == '2') { ?>
<td class=normal><? print"$price2"; ?></td></tr>
<? }
if(!isset($enter3) && $price3 && $i == '3') { ?>
<td class=normal><? print"$price3"; ?></td></tr>
<? }
... etc ...
So here, I have a new problem due to the fact that I cannot say something like:
if(!isset($enter[$i]) && $price[$i] && $i = $i) { ...
I tried a lot of things, but could not find any solution...
help would be greatly appreciated!!!