RE: Re: HELP - varible not passing from form

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



And if you ARE using $Name = $_GET["Name"], then maybe post a sample of
your PHP code so we can try to help you better.   The most common cause
of this issue is the "register_globals" thing, but it could be something
else as well.

Remember, GET method passes all your data through the browser URL (which
means you can simulate it by just using
"filename.php?varname1=Something&varname2=SomethingElse" in an href
link.  One benefit of this is that users can bookmark their search
results or query filter parameters or whatever data you're passing.

Some data is cumbersome or too much to really pass in the URL, in which
case you should use the POST method on the form.  This way, you'll only
see "filename.php" in the URL, but your data is still sent.  This is
slightly better for security (a web log will show a full URL, so it's
not good to send usernames and passwords or other sensitive data via the
GET method).


You can combine the GET and POST methods by using:

<form action="scriptname.php?GetVar1=Something&GetVar2=SomethingElse"
method="POST">

I'm not sure why you'd want to do this, but it's an option and I like
options.


Also good to know is that you can use $_REQUEST to receive $_GET, $_POST
and $_COOKIE variables in one command.  That is, if you use:

$somevar = $_REQUEST["somevar"];

You'll get data that's contained in $_GET["somevar"], $_POST["somevar"]
or $_COOKIE["somevar"].

I think that's the order of precendence too.  If a GET, POST and COOKIE
variable all exist with the same name, you end up with the cookie
variable.  If only GET and POST exist, then you end up with the POST
version.  If GET and COOKIE exist, you end up with COOKIE and if only
GET exists, you end up with GET["somevar"].  Make sense?

I'm pretty sure that's the order it goes in, but play around with it.
That's just off the top of my head.

That help any? Hah

-TG

> -----Original Message-----
> From: aRZed [mailto:paradox@xxxxxx] 
> Sent: Monday, August 23, 2004 5:01 AM
> To: php-windows@xxxxxxxxxxxxx
> Subject:  Re: HELP - varible not passing from form
> 
> 
> Ted Shaw wrote:
> 
> > G'day -
> > 
> > I've just installed PhP 4.3.8 for win - running Win2000. 
> Php seems to running ok but when I attempt to use "<form 
> method="get" action="http://localhost/filename";>
> > What is your name:
> > <input type="text" name="Name">
> > <input type="submit">
> > 
> > The info I type into the text box on the htm page gets 
> passed on the url to the php page, but I get a "Variable 
> Undefined" error in body of php page. There's no problem with 
> case in variable name. 
> > 
> > Have tried everything I know (which is not much)
> > 
> > Any help greatly appreciated.
> > 
> > 
> 
> register_globals is normally turned off on a standard installation.
> if you use $Name: try using $_GET["Name"] instead of $Name.
> It is generally a good idea to use those arrays instead of turning 
> register_globals on.
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux