Jump to content

[SOLVED] Defining $_POST


cliftonbazaar

Recommended Posts

I have a loop that gets a $_POST from the previous page which could be anything in the loop.  Each time I run the code I get a warning about

Notice: Undefined offset: 1 in C:\items.php on line 50
of each loop.

FOR($i=1; $i<=10; $i++) {
    IF($_POST[$i]) {  //There is something to be sold
      $items_array[$i]=$items_array[$i]-$_POST[$i];
      $player['gold']=$player['gold']+($_POST[$i]*$i*10);
    }
  }

 

Is there a piece of code I could write that checks to see if it is defined?

Link to comment
https://forums.phpfreaks.com/topic/163467-solved-defining-_post/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.