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? Quote Link to comment 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 Quote Link to comment 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? Quote Link to comment 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 Quote Link to comment 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]) } } Quote Link to comment 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(){} } Quote Link to comment Share on other sites More sharing options...
mrMarcus Posted December 18, 2009 Share Posted December 18, 2009 show the entire loop. Quote Link to comment 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! Quote Link to comment 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'. 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.