I am a newbie in PHP. I just want to know why every time I save a string data from textarea it's always having the <p> string </p>
format inserted in the database. This is my code:
<table>
<tr>
<td>
<textarea name="event_desc" cols="40" rows="10" id="event_desc"></textarea>
</td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Add" id="Add" value="Add event" /></td>
</tr>
</table>
And everytime i include a single quotation (')
, it always appears as " & #39;"
without space.This is the sample output:
input: test2 ' (and every space i made count)
<p> test2 ' $</p>
I already use mysql_real_escape_string, addslashes and stripslashes.
This is my code in saving into database:
<?php
if(isset($_REQUEST['Add']))
{
$event_title=$_POST['event_title']; $event_desc=mysql_real_escape_string($_POST['event_desc']);
$section=$_POST['section'];
$get_date=NOW;
if($event_title=="" || $event_desc=="")
{
echo'<div class="warning">Some of the fields are empty.</div>';
}
else
{
mysql_query("INSERT INTO events (`event_title`, `event_desc`,`event_date`,`event_target`) VALUE('$event_title','$event_desc','$get_date','$section')") or die(mysql_error('Error: Error in adding entries'));
echo'<div class="success">You have just added 1 event for School. You will be redirect in 5 seconds</div>';
echo "<META HTTP-EQUIV='Refresh' CONTENT='5; URL=events.php'>";
}
}
?>
Thanks you guys for the help.