Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Re: [PHP-DB] Register Globals = OFF not passing variable
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/langua....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
>
>

Report this thread to moderator Post Follow-up to this message
Old Post
Daniel Watrous
09-25-04 08:58 AM


Re: [PHP-DB] Register Globals = OFF not passing variable
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/langua....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
>
> 
>

Report this thread to moderator Post Follow-up to this message
Old Post
Craig Hoffman
09-25-04 08:58 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP DB archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:26 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.