Re: values out of form variables
| From: | Mitch Pirtle | Date: | Mon, 17 Feb 2003 11:58:57 +0000 |
| Subject: | Re: values out of form variables | ||
| References: | 1 | Groups: | php.install |
| Request: | Send a blank email to php-install+get-10057@lists.php.net to get a copy of this message | ||
On Fri, 2003-02-14 at 22:52, Mihir Dhond wrote:
> <form action="welcome.php" method="get">
> First Name: <input type="text" name="firstname" /><br />
> Last Name: <input type="text" name="lastname" /><br />
> <input type="submit" value="GO" />
> </form>
>
> code in welcome.php:
>
> <?php
> echo( "Welcome to my Website, $firstname $lastname!" );
> ?>
Change that to
echo "Welcome to my website, " . $_GET['firstname'] . " " .
$_GET['lastname'] . "!";
The reason for this is that with 4.3.0 register_globals is set to off by
default. This is a much-needed security measure, as it keeps curious
people like me from screwing around with your website by manually
entering variables and bogus values...
You can now reference form variables with $_GET and $_POST,
respectively. Read all about it here:
http://www.php.net/manual/en/language.variables.external.php
HTH,
Mitch
Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc
Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc