mike12255 Posted July 21, 2009 Share Posted July 21, 2009 The number of textboxes displayed depends on a previously entered number by a user. so i c reated a while statment and made textboxes while i was not equal to n(number entered by the user). I though i was giving the name/id of $i to the textboxes so when i went to call the $_POST of them i used the same method, a while statment calling the $_POST of I and increaseing I each time untill it equals n however my post returns blank each time does anyone know why? Below is my code: <?php if (isset($_POST['submit'])){ if ($_GET['done'] ==1){ $amount = $_GET['number']; $i=0; include "config.php"; while ($i != $amount){ $sql = "INSERT INTO pages (page) VALUES ('".$_POST['$i']."')"; //mysql_query($sql) or die(mysql_error()); echo $sql; echo $_POST['$i']; $i++; } } } $n = $_GET['number']; $i = 0 ; echo "<form action=\"step3.php?done=1&number=$n\" method=\"post\" class=\"form\">"; while($i < $n){ $over = $i+1; echo "<label for=\"username.$i\">Page.$over</label> "; echo "<div class=\"div_texbox\">"; echo "<input name=\"$i\" type=\"text\" class=\"username\" id=\"$i\" />"; echo "</div>"; $i++; ?> } ?> Quote Link to comment https://forums.phpfreaks.com/topic/166815-solved-how-should-i-call-the-_post-of-these-textboxes/ Share on other sites More sharing options...
premiso Posted July 21, 2009 Share Posted July 21, 2009 echo $_POST['$i']; Single quotes are taken literally. echo $_POST[$i]; Either do no quotes (above) or double quotes (below) echo $_POST["$i"]; Quote Link to comment https://forums.phpfreaks.com/topic/166815-solved-how-should-i-call-the-_post-of-these-textboxes/#findComment-879641 Share on other sites More sharing options...
mike12255 Posted July 21, 2009 Author Share Posted July 21, 2009 when will i learn...thanks Quote Link to comment https://forums.phpfreaks.com/topic/166815-solved-how-should-i-call-the-_post-of-these-textboxes/#findComment-879645 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.