Variable Variables
Posted: Sun Jan 23, 2011 5:08 pm
Hopefully someone can throw a rookie a bone. I'm writing a multi-page registration form. The form on page 1 passes a list of names of attendees of a conference. Below is a very simplified section of page 2. The names are posting correctly to a database so I know they're getting passed but I can't get them to echo on the second page.
I get:
Code: Select all
<?php
$numattendees = 4;
$name1 = "Robert";
$name2 = "John";
$name3 = "Bill";
$name4 = "Fred";
$y = 1;
$namestr = "$name";
do {
$names = $namestr.$y;
echo "$names<br />";
$y++;
} while ($y <= $numattendees);
?>
Code: Select all
1
2
3
4
[ /code]
And should be getting:
[code ]
Robert
John
Bill
Fred
[ /code ]
I've tried several variations but nothing. Any help?
BTW, I tried the [code] tag for my results but it didn't render correctly.
Thanks!