Hi there,
I am trying to use a login and a contact form on one page, but im struggling with the php context
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>my webpage</title>
</head>
<body>
<?php
$user = 'admin';
$pass = 'admin';
if ($user != $_POST['username'] || $pass != $_POST['password']) { ?>
<form method="post" >
Enter username:
<input type="text" name="username" /><br/>
Enter Password:
<input type="password" name="password" /><br/>
<center><input type="submit value="login" /></center>
<?php } else { ?>
<?php
if ($_POST["email"]<>'') {
$ToEmail = 'my email
$EmailSubject = 'subject
$mailheader = "From: ".$_POST["email"]."\r\n";
$mailheader .= "Reply-To: ".$_POST["email"]."\r\n";
$mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n";
$MESSAGE_BODY = "Name: ".$_POST["name"]."<br>";
$MESSAGE_BODY .= "Email: ".$_POST["email"]."<br>";
$MESSAGE_BODY .= "comment".$_POST["comment"]."<br>";
mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure");
<p>Thank you for your comment</p>
<?php
} else {
?> <hr/><br/>
<form method="post">
Enter Name:
<input type="text" name="name" /><br/>
Enter Email:
<input type="text" name="email" /><br/>
Comment:
<input type="textarea" name="comment" /><br/>
<center><input type="submit" name="submit" value="Send" /></center>
<?php }; ?>
</body>
</html>
if i use that code i get a HTTP 500 INTERNAL SERVER ERROR,
But if i use just this part of the code it all works fine????
<?php
if ($_POST["email"]<>'') {
$ToEmail = 'my email
$EmailSubject = 'subject
$mailheader = "From: ".$_POST["email"]."\r\n";
$mailheader .= "Reply-To: ".$_POST["email"]."\r\n";
$mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n";
$MESSAGE_BODY = "Name: ".$_POST["name"]."<br>";
$MESSAGE_BODY .= "Email: ".$_POST["email"]."<br>";
$MESSAGE_BODY .= "comment".$_POST["comment"]."<br>";
mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure");
<p>Thank you for your comment</p>
<?php
} else {
?> <hr/><br/>
<form method="post">
Enter Name:
<input type="text" name="name" /><br/>
Enter Email:
<input type="text" name="email" /><br/>
Comment:
<input type="textarea" name="comment" /><br/>
<center><input type="submit" name="submit" value="Send" /></center>
<?php }; ?>
any one got any ideas?
I am after creating a contact form but only for people who know the password.