ocsurf
asked on
accessing dynamic var
in a form i use this code
// $numbOpt is set else where for this lets say $numbOpt = 5
$num=0;
while($num < $numbOpt) {
$num++;
print'
input name="opt$num" type="text">';
}
in the next page is use this code which doesn't work
while($numbOpt > 0){
$Opt = "$opt".$numbOpt;
$query = "insert into PollOptions"
." ( `id` , `Qnumb` , `option` ) values "
."('','$Qid','$Opt')";
mysql_query($query);
$numbOpt--;
}
does anyone know how to do this, i can't figure it out. thanks
// $numbOpt is set else where for this lets say $numbOpt = 5
$num=0;
while($num < $numbOpt) {
$num++;
print'
input name="opt$num" type="text">';
}
in the next page is use this code which doesn't work
while($numbOpt > 0){
$Opt = "$opt".$numbOpt;
$query = "insert into PollOptions"
." ( `id` , `Qnumb` , `option` ) values "
."('','$Qid','$Opt')";
mysql_query($query);
$numbOpt--;
}
does anyone know how to do this, i can't figure it out. thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
i think you could have also used
$Opt = "$opt".$numbOpt;
echo $Opt.'='.$$Opt;
$Opt = "$opt".$numbOpt;
echo $Opt.'='.$$Opt;
while($numbOpt > 0){
$Opt = "$opt".$numbOpt;
$query = "insert into PollOptions('id','Qnumb','
mysql_query($query);
$numbOpt--;
}