Results 1 to 5 of 5
  1. #1
    komo
    Guest
    MAMP: PHP can't catch HTTP variables
    right now i have a little projects using PHP and MySQL, using MAMP as a development framework on my iBook.
    it worked fine to test php scripts and manipulating MySQL databases. but, as the project went on, i found a small but very annoying glitch on my MAMP. whenever i tried to pass HTTP variables, whether using Get or Post methods, the PHP scripts could never catch them.

    at first i thought it's just an error on my scripts, but those same scripts works well when i tested them on my Windows machine (using AppServ), so I thought it must be a problem with some configurations, not with my scripts

    is there somehow any configurations needed on MAMP that cause my problem??

    thx upfront.

  2. #2
    MAMP: PHP can't catch HTTP variables
    Murlyn's Avatar
    Member Since
    Jun 11, 2003
    Location
    Mount Vernon, WA
    Posts
    4,915
    Specs:
    MacBook Pro 2.6 GHz Core 2 Duo 4GB RAM OS 10.5.2
    Are you using these variables?

    $_POST, $_GET, $_REQUEST, $_SERVER etc? Sometimes people use the old way of coding using register_globals turned on.. which is a no no

  3. #3
    komo
    Guest
    no, i used $<variable-name> e.g. $myvar
    do i really have to use those old ways?? i kinda hate it, not practical at all..

  4. #4
    MAMP: PHP can't catch HTTP variables
    sarahsboy18's Avatar
    Member Since
    Jan 30, 2005
    Location
    Fort Worth, Texas
    Posts
    1,069
    Specs:
    Mac Pro, 8-Core 2.8Ghz, 10GB RAM, 2x1TB HDDs, iPod U2 Edition
    Yeah, Sounds like you don't have register globals turned on... You can turn it on in the php.ini file in the conf directory in MAMP. But like Murlyn said if you plan to put this on a live server it is a major security risk.

    If you are concerned about putting the $_POST in each line the best way to handle this is to assign all of your variables at the front of the script or even in a seperate include... e.g. $_POST['var1'] = $var1

    Just make sure you include them in the header of each function you write as the will not carry otherwise.
    "If you had a friend who was a tightrope walker, and you were walking down a sidewalk, and he fell, that would be completely unacceptable." -Mitch Hedberg

  5. #5
    komo
    Guest
    wow, thanks a lot, i never thought to put an "alias" for HTTP variables, but for now i think i'll stick with global variables. it's just for another school assignment
    thanks again...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Global Variables In iOS?
    By Loon3y in forum iOS Development
    Replies: 2
    Last Post: 12-02-2011, 04:55 PM
  2. Anyone help me figure out why php won't run even though I'm using MAMP
    By zipsfan21 in forum Web Design and Hosting
    Replies: 4
    Last Post: 02-08-2011, 06:58 PM
  3. how to write php files with MAMP ?
    By Eisa in forum Web Design and Hosting
    Replies: 3
    Last Post: 05-18-2008, 11:32 AM
  4. MAMP vs MAMP Pro
    By spilio in forum Web Design and Hosting
    Replies: 0
    Last Post: 12-14-2007, 06:30 AM
  5. Setting up PHP and PHP Nuke
    By EvoMac in forum Web Design and Hosting
    Replies: 2
    Last Post: 02-18-2005, 12:38 PM

Posting Permissions

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