OK, my major hold up here is not getting the format rules of PHP. I don't get when I need a backslash and when I don't. The rules just don't make sense to me. What I'm trying to do is send the user back to the login page if their input is not accepted. If it is accepted, I want to send them to the guest book. I could probably write a function and then in the conditional statement just send the right page to the redirect function.
That didn't work. I'm sure it's just syntax stuff.PHP Code:<BODY>
<?PHP
$db = @mysql_connect("connection", "root", "password") or die("Could not establish connection with database");
mysql_select_db('guestbook');
$query = "INSERT INTO Guests(UserName, Email, Comments, Date) Values('$UserName', '$Email', '$Comments', '".date("Y-m-d")."')";
$result = mysql_query($query) or die("Unable to enter your information. Please try again later.");
if $result
{
<SCRIPT LANGUAGE="javascript">
document.location.href='test.php'
</script>
}
else
{
<SCRIPT LANGUAGE="javascript">
document.location.href='login.php'
</script>
}
?>
</BODY>




Reply With Quote