Php

V

vtupser

Guest
I have Apache and PHP 5 installed on my Mac and run it as a testing server before uploading to my host site. I have been scripting in PHP for a while, but cant understand why I keep running into this one problem. I have created a form and use the post method to send to a handling page, but when I go to retrieve the variables from the post, they will not show up to be processed. Every other part of PHP shows up (when viewed in a browser) i.e. print function, if then statements, etc, but the variables wont be extracted and be processed. Now for the kicker, when I upload my page to a hosting server and view, everything works fine—variables extracted and all. Any clue why my machine wont pick up the variables? Any help would be great! Thanks.
 
OP
C

cerberos

Guest
You probably have register_globals disabled on your local machine.

Instead of reffering to a variable named $qwerty, try $_POST["qwerty"];
 
OP
V

vtupser

Guest
Thanks, do you know how I would go about changing the register_globals on my machine?
 
Joined
Jun 11, 2003
Messages
4,915
Reaction score
68
Points
48
Location
Mount Vernon, WA
Your Mac's Specs
MacBook Pro 2.6 GHz Core 2 Duo 4GB RAM OS 10.5.2
Don't, always use the global vars $_POST, $_GET, $_SERVER, $GLOBALS, etc.. always use those, so that they will be compatible with I believe PHP 4.1x and up, including PHP 5.
 
OP
R

ryanyogan

Guest
Yea they tried using globals as the default for a little bit in php4 , however it caused some major issues. They then turned it off by default, if you still find that you want to use this you can turn it on in your php.ini file! It is the near the top, I highly recomend you keep this off, it is just good practice to use $_POST['var'];, or $_HTTP_POST_VARS['var']; the second is becoming obsolete as well!
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top