I have a form, and it a javascript calls a php that echo the input on an "ul" using ajax.
the thing is that, it echos everything, even when the form is blank, with no text, it echos that "blank" value.
How do i do so it doesnt echo when the input is blank?
Note:
addcontentbox = the input id/name.
config.php is the databse config
"wall" is the id of the unsorted list.
Any sugestions? guide? =[
the thing is that, it echos everything, even when the form is blank, with no text, it echos that "blank" value.
How do i do so it doesnt echo when the input is blank?
Code:
<?php if(isset($_POST['addcontentbox'])){ /* Connection to Database */ include('config.php'); /* Prevent Query Injection */ $message = mysql_real_escape_string($_POST['addcontentbox']); /*echo*/ $sql = 'INSERT INTO WALL (message) VALUES( "'.$message.'")'; mysql_query($sql); echo $message; } else { echo '0'; } ?>
addcontentbox = the input id/name.
config.php is the databse config
"wall" is the id of the unsorted list.
Any sugestions? guide? =[
Comment