Hello all-<br />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.<br /><br />I was previously requesting my form fields by saying something like:<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->$fname = $_REQUEST['firstname'];<!--c2--></div><!--ec2--><br /><br />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 <br />now I'm getting some weird results, like SQL errors which I've never gotten before. <br /><br />Please help! <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/wallbash.gif" style="vertical-align:middle" emoid=":wallbash:" border="0" alt="wallbash.gif" /><!--content-->
Hi Sarah,<br /><br />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.<br /><br />Remember, these are FAMILY forums....<!--content-->
sorry, got carried away <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/sad.gif" style="vertical-align:middle" emoid="" border="0" alt="sad.gif" /><!--content-->
In addition, I am getting this error:<br /><br />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<br /><br />I have no idea what this error is. My line 26 reads:<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->print "$_POST['action'] is the action";<!--c2--></div><!--ec2--><br /><br />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?<!--content-->
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.<br /><br />However, the $_POSTs are still giving me problems. I don't think I am referencing them properly.<!--content-->
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.<br /><br />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.<!--content-->
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).<br /><br />$_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 <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid="" border="0" alt="smile.gif" /><!--content-->
I am sending more information in a PM, I hope that is okay<!--content-->
Sure, no problem <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid="" border="0" alt="smile.gif" /><br /><br />I just replied to your PM <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/wink.gif" style="vertical-align:middle" emoid="" border="0" alt="wink.gif" /><!--content-->
Hi Sarah,<br /><br />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.<br /><br />Remember, these are FAMILY forums....<!--content-->
sorry, got carried away <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/sad.gif" style="vertical-align:middle" emoid="" border="0" alt="sad.gif" /><!--content-->
In addition, I am getting this error:<br /><br />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<br /><br />I have no idea what this error is. My line 26 reads:<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->print "$_POST['action'] is the action";<!--c2--></div><!--ec2--><br /><br />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?<!--content-->
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.<br /><br />However, the $_POSTs are still giving me problems. I don't think I am referencing them properly.<!--content-->
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.<br /><br />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.<!--content-->
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).<br /><br />$_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 <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid="" border="0" alt="smile.gif" /><!--content-->
I am sending more information in a PM, I hope that is okay<!--content-->
Sure, no problem <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid="" border="0" alt="smile.gif" /><br /><br />I just replied to your PM <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/wink.gif" style="vertical-align:middle" emoid="" border="0" alt="wink.gif" /><!--content-->