My code for the input php file is the following.
<!DOCTYPE html>
<html>
<body>
<form name="input" action="welcome.php" method="post">
Comment: <textarea name="input" rows="5" cols="40"></textarea>
<input type="submit" value="Submit">
</form>
</body>
</html>
For the output code it is the following.
<html>
<body>
Welcome <?php $a=$_POST["input"]; echo $a; ?><br>
</body>
</html>
When anything with extra spaces and newline are inputted, it automatically gets removed. For example :
When I input:
abcd
cda xyzb
Output is:
Welcome abcd cda xyzb