Jump to content

Recommended Posts

Posted

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! :tchrocks:

Posted

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....

Posted

sorry, got carried away :tchrocks:

Posted

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?

Posted

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.

Posted

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.

Posted

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 :blink:

Posted

I am sending more information in a PM, I hope that is okay

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...