I am relatively new to web development. I have a simple text input and submit button in html.
<div>
<input type="text" name="sender" id="sender" class="form-control" placeholder="" />
<input type="submit" class="btn-u btn-u-small" name="send" value="Send email" />
</div>
I get the value of the text input in php and echo
it.
<?php
if(isset($_POST["send"]))
{
echo $_POST["sender"] . "
This was a test";
}
?>
Now I type
User input
in text input. I intend the echo
command to look like:
echo "User input." . "
This was a test."
And when displayed, should look like:
User input. This was a test.
Instead the first
prints as it is and only the second
is interpreted as CRLF
.
User input. This was a test.
I've tried '
' "
" \\
but non seem to work.
Note: I don't want actual line break in html, I know that in html line breaks are <br />
. I want a line break in php string.