06-05-2006, 04:54 AM #1komoGuestMAMP: 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??
06-05-2006, 07:38 AM #2
- Member Since
- Jun 11, 2003
- Mount Vernon, WA
- 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---> Join the Mac-Forums Folding team: use 37954 as your team number.
View Mac-Forums Folding team statistics (More Info)
Don't forget to use the User Reputation System
06-05-2006, 09:46 AM #3komoGuest
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..
06-05-2006, 10:46 AM #4
- Member Since
- Jan 30, 2005
- Fort Worth, Texas
- 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
06-05-2006, 11:39 AM #5komoGuest
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
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
By Loon3y in forum iOS DevelopmentReplies: 2Last Post: 12-02-2011, 05:55 PM
By zipsfan21 in forum Web Design and HostingReplies: 4Last Post: 02-08-2011, 07:58 PM
By Eisa in forum Web Design and HostingReplies: 3Last Post: 05-18-2008, 12:32 PM
By spilio in forum Web Design and HostingReplies: 0Last Post: 12-14-2007, 07:30 AM
By EvoMac in forum Web Design and HostingReplies: 2Last Post: 02-18-2005, 01:38 PM