Re: Newbie, easy question...
| From: | Ben | Date: | Wed, 22 Dec 2004 00:35:00 +0000 |
| Subject: | Re: Newbie, easy question... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-204913@lists.php.net to get a copy of this message | ||
Garyh wrote:
Below is a simple php file that recieves input from a form html file. The php file outputs the first and last name, but their is no space between the names. Does anyone know how I can get a space between name in the php file?As a minimum this will work: <? print("<p>"$fusername." ".$lusername."</p>"); ?> But it's a better idea to do something like this (assuming your form on the preceding page is like the following): <form name="yourform" action="yourscript.php" method="post"> You'd want to do this in yourscript.php: <? // Remove any tags from all $_POSTed variables to avoid xss problems foreach($_POST as $key => $value) {
$_POST[$key]=strip_tags($value);
}
print("<p>".$_POST['fusername']." ".$_POST['lusername']."</p>");
?>
- Ben