Re: Register Globals = OFF not passing variable

From: Date: Sat, 25 Sep 2004 03:11:15 +0000
Subject: Re: Register Globals = OFF not passing variable
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-36383@lists.php.net to get a copy of this message
Daniel, Thanks. Thats what I was looking for. Regards, Craig On Sep 24, 2004, at 9:40 PM, Daniel Watrous wrote:
Craig, I don't see where you are calling the function "display_private_results", but I think I know what you are after. It appears you are expecting POST data and so have used the _POST superglobal. You have one of two options: Option 1: call the function sending parameters as you have shown below, but use superglobals e.g. display_private_results($_POST["user_id"], $_POST["area"], $_POST["username"]); NOTE: this would make it seem a little awkward to use the _POST super global inside the function you may want to put it outside the function Option 2: call the function sending NO parameters e.g. display_private_results() and re-write your function to look like this: function display_private_results() { if ($_POST['postback_private_results']) { include "include/db.php"; $query = "SELECT routes.*, users.* FROM users, routes WHERE area='$_POST["area"]' AND username='$_POST["username"]' "; and so on... Hope this helps. If it doesn't I suspect that some reading on superglobals will resolve your dilemma... http://www.php.net/manual/en/language.variables.predefined.php Daniel Watrous ----- Original Message ----- From: "Craig Hoffman" <choffman@eclimb.net> To: <php-db@lists.php.net> Sent: Friday, September 24, 2004 7:12 PM Subject: [PHP-DB] Register Globals = OFF not passing variable
Hey Folks, I can use some help here. I am changing some scripts around so they work with (register) globals off. I am trying to pass variables in a function and it does not seem to be passing. The script work fine with globals turned on. I would really like to have them work with RG turned off. Any help would be appreciated. Here is a short example: <PHP function display_private_results($user_id, $area, $username) { if ($_POST['postback_private_results']) { include "include/db.php"; $query = "SELECT routes.*, users.* FROM users, routes WHERE area='$area' AND username='$username' "; and so on... Much Thanks, Craig -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.db (#36383) next »