Reputation: 203
so i have this Text area wherein the data will be posted to the database.
so here is an image of what my sample input might look like.it has spacing via enter key but when it is send to the database the spacing wont be there and the display of the input will be
<?php
require("common.php");
if(empty($_SESSION['user']))
{
header("Location: login.php");
die("Redirecting to login.php");
}
?>
<?php
$host="localhost";
$username="root";
$password="";
$db_name="phplogin";
$tbl_name="tasks";
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$Ttoday=$_POST['comment1'];
$task_issues=$_POST['comment2'];
$Ttom=$_POST['comment3'];
$id=$_POST['comment'];
$sql="INSERT INTO $tbl_name(task_today, issues, task_tom, U_ID)VALUES('$Ttoday', '$task_issues', '$Ttom', '$id')";
$result=mysql_query($sql);
if($result){
header("Location: private.php");
exit;
}
else {
echo "ERROR";
}
?>
<?php
// close connection
mysql_close();
?>
here is my insert codes.
Upvotes: 0
Views: 282