i am using php.my project is to build a forum...everything is fine and ok except onething...there is a <textarea>
on top of my site,through which user can ask their question..now am using insert into
command to insert whatever user has wriiten in textarea and select
command to fetch the posts from database and the display it using echo
command
problem : unable to keep the user's text indentation intact
suppose user has written
#include<stdio.h>
#include<conio.h>
int main()
{
...and so on;
}
this code in the text area,while am displaying it through echo then the output is like
#include<stdio.h>#include<conio.h>int main(){...and so on;}
so my question is how can i keep the text indentation of user intact
edit 1:my insertion code
<?php
include_once $_SERVER['DOCUMENT_ROOT'].'/include/db.inc.php' ;
$myemail=$z;
$sem=$_POST['semester'];
$course=$_POST['course'];
$title=$_POST['title'];
$desc=$_POST['question'];
$date=date('Y-m-d H:i:s');
$sem = mysqli_real_escape_string($link, $sem);
$course = mysqli_real_escape_string($link, $course);
$title = mysqli_real_escape_string($link, $title);
$desc = mysqli_real_escape_string($link, $desc);
$sql = "INSERT INTO wbut_forum_posts SET post_title='$title',post_desc='$desc',course='$course',semester='$sem',post_by='$myemail',post_date='$date'";
if (!mysqli_query($link,$sql))
{
include_once "wall.html.php";
echo "<script language=javascript> alert(\"SOMETHING WENT WRONG, TRY AGAIN LATER !!!\");</script>";
exit();
}
else
{
include_once 'wall.html.php';
echo "<script language=javascript> alert(\"YOUR POST SUCCESSFULLY HAS BEEN POSTED\"); </script>";
exit();
}