How to do this? 6 lines of code...Parse error
| From: | Ryan A | Date: | Sat, 03 Jan 2004 21:40:20 +0000 |
| Subject: | How to do this? 6 lines of code...Parse error | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-173693@lists.php.net to get a copy of this message | ||
Hi,
am a bit confused as to how you do this...first let me explain the flow of
input:
I will be getting $product1,$product2,$product3 etc from another script...I
dont know till what number....right now I am trying to catch the values till
20 with a "for" loop.
My problem is how do I attach the $i that I am using to the $product to
check if its set? Heres my code and below that you will see some of the
stuff I have tried:
for($i=1; $i<21; $i++)
{ if(isset($product$i))
{echo "Product".$i." is set!<br>";}
else(!isset($product$i))
{echo "Product".$i." is NOT set!<br>";}}
exit;
This is what I have tried (in the if-isset part) :
$product.$i
$product."".$i
$product.''.$i
$product($i)
all of the above give me a parse error.
Any help appreciated.
Thanks,
-Ryan
P.S, I didnt write the other script where I am getting the values from...I
just have to work with it as they are not allowing me to touch the older
script so I dont have access to it.