morocco-iceberg Posted April 15, 2010 Share Posted April 15, 2010 I'm supposed to use a do while loop to list the names of the children... and everything I've attempted just won't work. There are three pages: Page One asks how many children the person has... <form action="kids.php" method="post"> How many children do you have? <input type="text" name="number" value="" /> <input type="submit" name="one" value="Next" /> Page Two then asks for the childrens names and genereates an input box per child... <?php $number=$_POST['number']; echo "You have $number children.<br /><form action=\"kidsResults.php\" method=\"post\"><input type=\"hidden\" name=\"number\" value=\"$number\" />"; for($counter=1;$counter<=$number;$counter+=1){ echo "Name of child $counter <input type=\"text\" name=\"$counter\" value=\"\" />"; } echo "<input type=\"submit\" name=\"two\" value=\"Next\" /></form>" ?> But I can't seem to get my head around Page Three, which is supposed to list the children's names... <?php $number=$_POST['number']; $counter=0; while($counter<=$number){ $counter=$counter+1; $counter=$_POST['$counter']; echo $counter; } ?> Help! Link to comment https://forums.phpfreaks.com/topic/198608-help-multiple-pages-passing-variables-stuck-on-the-last-one/ Share on other sites More sharing options...
morocco-iceberg Posted April 15, 2010 Author Share Posted April 15, 2010 Solved it myself, was just some syntax throwing me off. Link to comment https://forums.phpfreaks.com/topic/198608-help-multiple-pages-passing-variables-stuck-on-the-last-one/#findComment-1042220 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.