canabatz Posted December 18, 2009 Share Posted December 18, 2009 i need to loop 130 times and post data what is the way to do it? i tryed this ,but it's not working for ($c=0; $c<=129; $c++){ if($_POST['data'] == $_POST['data.$c']) } i need to have it like that: $_POST['data'] == $_POST['data0'] $_POST['data'] == $_POST['data1'] $_POST['data'] == $_POST['data2'] $_POST['data'] == $_POST['data3'] 130 times! what im doing wrong? Link to comment https://forums.phpfreaks.com/topic/185593-_post-in-for-loop/ Share on other sites More sharing options...
emopoops Posted December 18, 2009 Share Posted December 18, 2009 use the variable c for the number that gets bigger, take out the if statment Link to comment https://forums.phpfreaks.com/topic/185593-_post-in-for-loop/#findComment-979824 Share on other sites More sharing options...
oni-kun Posted December 18, 2009 Share Posted December 18, 2009 Not 100% sure if this works, but you added the wrong syntax to your loop. "<" is lessthan, so it'll just not loop. for ($c=0; $c>=130; $c++){ echo $_POST['data'] == $_POST['data'.$c]; } But what is this code for? From the looks of it.. It could be accomplished a much simpler way. You forgot colons and what is the if for? Link to comment https://forums.phpfreaks.com/topic/185593-_post-in-for-loop/#findComment-979829 Share on other sites More sharing options...
canabatz Posted December 18, 2009 Author Share Posted December 18, 2009 i dont understand don look at the if ,the if is for the rest of the code! if data = some data0....... it will do the rest! my problem is that it's not looping. thanx Link to comment https://forums.phpfreaks.com/topic/185593-_post-in-for-loop/#findComment-979831 Share on other sites More sharing options...
rajivgonsalves Posted December 18, 2009 Share Posted December 18, 2009 your code should be for ($c=0; $c<=129; $c++){ if($_POST['data'] == $_POST['data'.$c]) } } Link to comment https://forums.phpfreaks.com/topic/185593-_post-in-for-loop/#findComment-979833 Share on other sites More sharing options...
emopoops Posted December 18, 2009 Share Posted December 18, 2009 if c is less than 130 . thats it for(){ if(){} } Link to comment https://forums.phpfreaks.com/topic/185593-_post-in-for-loop/#findComment-979834 Share on other sites More sharing options...
mrMarcus Posted December 18, 2009 Share Posted December 18, 2009 show the entire loop. Link to comment https://forums.phpfreaks.com/topic/185593-_post-in-for-loop/#findComment-979841 Share on other sites More sharing options...
canabatz Posted December 18, 2009 Author Share Posted December 18, 2009 it's working sorry ,i had a break; in some part of the loop!! thanx if($_POST['data'] == $_POST['data'.$c]) is working! Link to comment https://forums.phpfreaks.com/topic/185593-_post-in-for-loop/#findComment-979845 Share on other sites More sharing options...
oni-kun Posted December 18, 2009 Share Posted December 18, 2009 it's working sorry ,i had a break; in some part of the loop!! thanx if($_POST['data'] == $_POST['data'.$c]) is working! Yep. Just remember variables don't resolve in single quotations. That's why you had to concatenate it after the 'data'. Link to comment https://forums.phpfreaks.com/topic/185593-_post-in-for-loop/#findComment-979848 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.