i want to insert values in to a array in one page using a while loop. i dnt know how many vlaues will be ienterd so i used the following code:
Code:
<? $name=array();
$i=0;
while ($val2=mysql_fetch_array($result2)) {
$name[$i]=$val2["s_id"];
$i=$i+1;
echo($name[$i]);
}
then i passed this array to anothr page like this:
$name=urlencode(serialize
($name));
?><input name="names" type="hidden"
id="names" value="<? $name ?>">
on the nex page i said:
$name=unserialize(urldecode
($_REQUEST["names"]));
if(!empty($name)){
echo($name[0]);
}
else {
echo("no value");
}
Problem: it dnt return any value sn the 2n page and on the 1st pae gives this error: -
Undefined offset: 1 on the line having - echo($name[$i]); on the first page.
Please HELP!