everyone..
trying to submit a form.. and form and php code is in the same file index.php
if(isset($_POST['post_form'])) {
echo "ISSET";
$post_sender=$id;
$post_reciever=$id2;
$post_cont=$_POST['news_text'];
$post_cont=htmlentities($post_cont);
$post_cont=mysql_real_escape_string($post_cont);
$post_sql=mysql_query("INSERT INTO wall_posts (from, to, content, date) VALUES ('$post_sender','$post_reciever','$post_cont',now())") or die(mysql_error());
}else{
echo "NOT SET";
}
html form
<form method='POST' action='index.php' enctype='multipart/form-data' id='news_form' name='post_form' >
<textarea id='news_text' name='news_text' >type here..........</textarea>
<input type='submit' id='wall_post_btn' name='wall_post_btn' value='submit'>
</form>
where is my mistake..???
there is no mistake in the code..the file itself is corrupted..just made a test in a new PHP file…works just fine…thanks guys..
The problem is You are checking the name of the form present in the
$_POST, which is never present…What You should test is the name of the submit button, e.g.:
Next You could use one line for sanitizing the input:
And last one: start using PDO with prepared statements or at least
mysqli_*functions asmysql_*ones are deprecated now…