PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
6tr6tr
Forum Newbie
Posts: 4 Joined: Mon Jun 08, 2009 4:50 pm
Post
by 6tr6tr » Mon Jun 08, 2009 4:51 pm
How can i tell if a POST method is what reached the php page? I tried the code below, but it is always true:
requinix
Spammer :|
Posts: 6617 Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA
Post
by requinix » Mon Jun 08, 2009 6:35 pm
Stop using $HTTP_POST_VARS and start using $_POST.
Hint: look in $_SERVER.
mikemike
Forum Contributor
Posts: 355 Joined: Sun May 24, 2009 5:37 pm
Location: Chester, UK
Post
by mikemike » Mon Jun 08, 2009 7:29 pm
requinix
Spammer :|
Posts: 6617 Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA
Post
by requinix » Mon Jun 08, 2009 8:15 pm
mikemike wrote:
works for me
But what if there wasn't anything posted?
Torrodon
Forum Newbie
Posts: 4 Joined: Sun Jun 07, 2009 7:24 am
Post
by Torrodon » Mon Jun 08, 2009 9:13 pm
Better check if the variable you are going to use are what they should be
Code: Select all
if($_POST[submit_button_name] <> 'Submit') ..... //this include empty var
6tr6tr
Forum Newbie
Posts: 4 Joined: Mon Jun 08, 2009 4:50 pm
Post
by 6tr6tr » Tue Jun 09, 2009 8:50 am
mikemike wrote:
works for me
Thanks that one works.
Just out of curiousity, why is _POST better than the previous HTTP_POST_VARS?
jayshields
DevNet Resident
Posts: 1912 Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England
Post
by jayshields » Tue Jun 09, 2009 8:53 am
$HTTP_POST_VARS is deprecated, and it isn't a superglobal.