Re: Newbie, easy question...

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

 



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

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux