Sarah Posted December 6, 2005 Posted December 6, 2005 Hello all- In one of my other threads I was talking about turning off register_globals in the php.ini file for security purposes. Well I got it turned off, and now my scripts are really screwed up! I don't know what I did but I'm seriously hoping I could fix it. I'm sure hope it's something small. I was previously requesting my form fields by saying something like: >$fname = $_REQUEST['firstname']; That was with register globals on, and now I'm under the impression I should be using the $_POST var instead of $_REQUEST. So I changed all my instances of REQUEST in my code that takes form vars and now I'm getting some weird results, like SQL errors which I've never gotten before. Please help! Quote
abinidi Posted December 6, 2005 Posted December 6, 2005 Hi Sarah, I don't have an answer for your question, but I thought I would let you know that I find your title offensive, even though you used asterisks to replace some of the letters. Remember, these are FAMILY forums.... Quote
Sarah Posted December 6, 2005 Author Posted December 6, 2005 In addition, I am getting this error: Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /myfile.php on line 26 I have no idea what this error is. My line 26 reads: >print "$_POST['action'] is the action"; All I am trying to do is make sure these variables are printing out what they are supposed to be. In this instance, I am passing 'action=view' in the URL in my script. the url reads 'myfile.php?action=view' and then I get the parse error. Maybe this isn't POST? is that why this isn't working? Quote
Sarah Posted December 6, 2005 Author Posted December 6, 2005 I've come to the conclusion the variables that get passed in the URL are not members of the $_POST superglobal, they are from $_GET, which clears up a lot for me. So I've changed those $_POST references back to $_REQUEST. However, the $_POSTs are still giving me problems. I don't think I am referencing them properly. Quote
Sarah Posted December 6, 2005 Author Posted December 6, 2005 I couldn't figure this out, it was causing MAJOR problems with my code so I gave up and turned register_globals back on, because that was the only way it could work. Well of course now I'm still getting some weird results again. I dont understand. *sigh* If anyone could help me, please send me a PM. Thanks. Quote
borfast Posted December 6, 2005 Posted December 6, 2005 Sarah, don't use $_REQUEST, use $_POST or $_GET, according to where your variables are coming from: $_POST for variables the script received via an HTTP POST (usually HTML forms) and $_GET for variables the script received via an HTTP GET (usually the variables passed on the URL). $_REQUEST is another global variable that includes $_GET, $_POST and $_COOKIE. Although you won't have both variables passed by GET and variables passed by POST, you can have two variables with the same name, one in a cookie and another in one of the other variable arrays, which will cause you some problems if you use $_REQUEST. It's just a good programming habit Quote
Sarah Posted December 7, 2005 Author Posted December 7, 2005 I am sending more information in a PM, I hope that is okay Quote
borfast Posted December 7, 2005 Posted December 7, 2005 Sure, no problem I just replied to your PM Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.