I am trying to create a pastebin type of thing. I have got my php code
<?php
printf("uniqid(): %s\r\n", uniqid());
?>
<!DOCTYPE html>
<meta charset="UTF-8">
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<title>Xdev - CodeShare</title>
</head>
<form method="post" action="cslink.php">
<textarea cols="100" rows="20" name="textbox"></textarea>
<br />
<input type="submit" value="Submit now" />
</form>
and my php file to store it in my mysql database
<?php
require 'connect.php';
// Connecting to the MySQL database
$conn = mysql_connect($host, $user, $pass);
mysql_select_db($db);
$username = $_POST['textbox'];
$sql = "INSERT INTO `text` (`id`, `text` ) VALUES (NULL, '$username' );";
$retval = mysql_query( $sql, $conn );
if(! $retval )
{
die('Could not enter data: ' . mysql_error());
}
echo "Entered data successfully\n";
mysql_close($conn);
?>
and my view file (also in php)
<?php
require 'connect.php';
$sql = 'SELECT * FROM text WHERE id = 3';
$result = mysql_query($sql, $conn);
while ($row = mysql_fetch_assoc($result)){
$id = $row['id'];
$text = $row['text'];
echo "id: " . $id . "<br/>";
echo "text: " . $text . "<br/>";
echo $text;
}
?>
So if I type in:
hello
world
testing
(each on a separate line)
It will show up as this: hello world testing
- all in a single line
I want to know if I can and how to output it as separate lines