Jump to content

$_POST in for loop?


canabatz

Recommended Posts

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
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.