RE: [PHP] combining text with $_POST
| From: | John W. Holmes | Date: | Sun, 06 Apr 2003 01:00:18 +0000 |
| Subject: | RE: [PHP] combining text with $_POST | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-142556@lists.php.net to get a copy of this message | ||
> Hi all, how can I combine this line to use just 1 echo statement?
>
> echo "Name: "; echo $_POST['name']
The period is used for string concatenation:
echo "Name: " . $_POST['name'];
Many ways you can do it:
echo "Name: {$_POST['name']}";
echo 'Name: ' . $_POST['name'];
echo "Name: $_POST[name]";
echo 'Name: ' . $_POST["name"];
etc...
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/