Hi,
It's really late now,
I am trying to figure out how to echo a message when I submit a form.
Here is the code:
<?php
$msg = "";
if ($_POST['title'] != ""){
$title = $_POST['title'];
$author = $_POST['author'];
$author = stripslashes($author);
if (!$title){
$msg = "Please Add Title";
} else if (!$author){
$msg = "Please Add Author";
}
$query = mysql_query("INSERT INTO time (title, contents) VALUES ('$title', '$author')") or die (mysql_error());
$msg = "Submitted";
}
?>
Here is my Form:
<form action="addinfo.php" method="post">
Title:<br />
<input type="text" name"title" /><br /><br />
Author:<br />
<textarea name="author"></textarea>
<br /><br />
<input type="submit" name="submit" value="Submit" /><?php echo $msg; ?>
</form>
The issue is that the when I click Submit it should echo "Submitted" but it doesn't any suggestions?
I really appreciate if someone explain to me how fixed this minor issue. Thanks!