Re: Can't pass query string from HTML to PHP
| From: | Thorsten Körner | Date: | Fri, 20 Jun 2003 09:59:48 +0000 |
| Subject: | Re: Can't pass query string from HTML to PHP | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-152292@lists.php.net to get a copy of this message | ||
Hi again
Am Freitag, 20. Juni 2003 11:47 schrieb Thorsten Körner:
> Am Freitag, 20. Juni 2003 08:06 schrieb Robby Ku:
> > Hi,
> >
> > I've got a problem passing a query string from a HTML file to a PHP file.
> > I created a HTML file called "welcome.html" with the following link:
> >
> > <a href="welcome.php?name=Andy"> Hi, I'm Andy </a>
> >
> > I am trying to pass the query string Andy to a PHP file called
> > "welcome.php" with the following command:
> >
> > <?php echo ("Welcome, $name!"); ?>
>
> Change this line to:
> <?php
> echo"Welcome, " . $_GET['name'];
> ?>
> and that's it.
> If this doesn't work, because your PHP-Version is <=4.0.6 than try this, if
> you can't update:
>
> <?php
> echo"Welcome, " . $HTTP_GET_VARS['name'];
> ?>
Sorry I forgot the "!"-Char. So do it this way:
echo"Welcome, " . $_GET['name'] . "!";
or
echo"Welcome, " . $HTTP_GET_VARS['name'] . "!";
depending onyour PHP-Version.
> For security-reasons leave your php.ini with:
> register_globals=off
>
> > After i load "welcome.html" in my browser, i try linking it to
> > "welcome.php" through the hyperlink i created. But the result i got was
> >
> > "Welcome, !"
>
> "Welcome, Andy!" ;-)
Now it appears as wanted.
CU
Thorsten
--
Thorsten Körner http://www.123tkShop.org