Re: How do YOU initialize the form variables?
| From: | Richard Lynch | Date: | Thu, 31 May 2007 21:51:18 +0000 |
| Subject: | Re: How do YOU initialize the form variables? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-255936@lists.php.net to get a copy of this message | ||
On Thu, May 31, 2007 12:57 pm, info@phpyellow.com wrote:
> username
> lastname
> mobile
> .. and so on ...
>
> Example simple initialization:
> // POST
> $username = $_POST['username'];
> $lastname = $_POST['lastname'];
> $mobile = $_POST['mobile'];
I personally go with:
<?php
$username = isset($_POST['username']) ? $_POST['username'] : '';
$username_html = htmlentities($username);
?>
<input name="username" value="<?php echo $username_html?>" />
I dunno that you want to go with what 95% of people go with -- There's
a LOT of bad scripts out there...
Maybe you should be looking at the best 5% of PHP coders, and see how
they do it instead. :-)
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?