adam291086 Posted April 5, 2009 Share Posted April 5, 2009 i have my input names set to date1 date2 and i want to set up a little loop to get that data for example $number = 10; while($i<$number) { $date = $_POST['date'.$i.]; $1++ } i keep getting an internal server error why? Quote Link to comment Share on other sites More sharing options...
Alecdude Posted April 5, 2009 Share Posted April 5, 2009 I'd recommend using a for loop. for($duck=1;$duck<=10;$duck+=1) { //code here, will be looped 10 times } Quote Link to comment Share on other sites More sharing options...
adam291086 Posted April 5, 2009 Author Share Posted April 5, 2009 yeah but how can i get the post data? Quote Link to comment Share on other sites More sharing options...
corbin Posted April 5, 2009 Share Posted April 5, 2009 $1++ should be $i++ (or ++$i) And you could use date[] as your input names, and it would be an array instead of having to do that ghetto loop. Then you could do foreach($_POST['date'] as $key => $value). Quote Link to comment Share on other sites More sharing options...
adam291086 Posted April 5, 2009 Author Share Posted April 5, 2009 thanks, used corbins method Quote Link to comment 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.