SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Zealot
    Join Date
    Dec 2011
    Posts
    124
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Something weird happening with $_POST / form variables

    I've been making changes to a form I've been working on. I added the jquery-validation plugin for client side validation. Now my $_POST array is empty when it gets to my php script. I was messing around with echo statements and found that if I just used $ plus the field name from the form it has the value.

    PHP Code:
    echo 'requester_name: '$_POST['requester_name'] ."<br />";
    echo 
    'requester_name: '.$requester_name."<br />"
    The first is blank and the next one somehow has the value...
    Have I just not had enough caffeine yet this morning? What is happening here?

  2. #2
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,149
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    Is your form using GET or POST for its submission? As you may want to check $_GET['requester_name'] or $_REQUEST['requester_name']

  3. #3
    SitePoint Zealot
    Join Date
    Dec 2011
    Posts
    124
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes both of those worked. thanks that helped me find it. In my copy and paste madness the method='post' must have got deleted. But i'm still surprised that just having $ plus the input name had a value stored in it with out having to do something like $requester_name =$_POST['requester_name'] or $requester_name =$_Request['requester_name']

  4. #4
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    72 Post(s)
    Tagged
    0 Thread(s)
    That would indicate register_globals is on, which is highly discouraged. (In fact, it's so highly discouraged that this ability was removed from PHP entirely as of PHP 5.4.0)
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.

  5. #5
    SitePoint Zealot
    Join Date
    Dec 2011
    Posts
    124
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Good to know Thanks. For anyone else that needs to know you can turn register globals off by just changing:

    PHP Code:
    register_globals On 
    to
    PHP Code:
    register_globals Off 
    in the php.ini file located in my home directory

  6. #6
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    ... and restarting the server.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •