5

This is inside the phpmyadmin:

This is inside the phpmyadmin

This is the output after echo:

This is the output after echo

and this is the code for display output

$joinEvent  =   mysqli_query($db, "SELECT * FROM event WHERE event.eventID='".$_GET['eventID']."'");
while($row  =   mysqli_fetch_array($joinEvent))
{
  $joinDetails      =       $row['details'];
}

<p align="justify"><?php echo $joinDetails; ?></p>

How do I echo exactly what user enter in the input?

rink.attendant.6
  • 44,500
  • 61
  • 101
  • 156
Eefy
  • 51
  • 9

3 Answers3

2

Use nl2br() when you output to the screen, change your current code to:

<p align="justify"><?php echo nl2br($joinDetails); ?></p>
oreopot
  • 3,392
  • 2
  • 19
  • 28
0

It might be better for you to store your details column as a text datatype. Read here: What is the MySQL VARCHAR max size?

0

Your result is actually exactly what the user input is ; except that in HTML, line break characters (\r\n \n and so) are not interpreted by the browser. As said in the comments, you'll have to use the PHP function nl2br() to convert your line break characters to <br /> tags, which are the HTML line breaks.

OddBrew
  • 498
  • 3
  • 15