Saturday, 24 August 2013

PHP - How to Echo Post + $list in new line?

PHP - How to Echo Post + $list in new line?

I'm trying to create a PHP script that will "echo" name + name2 + surname
from post e.g John "Edward" "Smith" Thomas "Edward" "Smith" Chris "Edward"
"Smith" etc.
This is my script:
<form action="test.php" method="post">
Test: <input type="text" name="name2"> + <input type="text" name="surname">
<input type="submit" value="Submit" />
list of names:
<?php
$name= "
John
Thomas
Chris
(...)
";
?>
+
<?php echo $name; ?> "<?php echo $_POST["name2"]; ?>" "<?php echo
$_POST["surname"]; ?>"
When I press Submit I got this
John Thomas Chris + "Edward" "Smith"
instead of
John "Edward" "Smith"
Thomas "Edward" "Smith"
Chris "Edward" "Smith"
Any ideas? :) Thanks

No comments:

Post a Comment