Hi all,
I'm pretty new to PHP, coming from a background of just boring html. Anyway, this is my first attempt at a script that I can actually use (ie. I've moved on from "hello world" 😃), but when I try and run it, I get the error:
"Parse error: parse error, unexpected T_STRING in /home/virtual/site76/fst/var/www/html/PHP/script.php on line 55"
I can't see whats wrong on line 55... Can someone help me out? And perhaps point out bits of particularly crappy coding, or bits that could be shortened into simpler code? The form that is used to obtain the variables for this code can be found at
www.lore-league.com/PHP/form.html
Cheers.
<?
//check fields have been correctly filled out
if($email = "") {
$error = "Please enter an email address";
ErrorPage($error);
}
if($password!=$passwordverify) {
$error = "Passwords did not match";
ErrorPage($error);
}
if($username = "") {
$error = "Please enter a username";
ErrorPage($error);
}
Else {
PrintConfirm($encryptedpass);
$encryptedpass = md5($password);
//compose email here
$to = $email;
$subject = "Application Recieved Successfully";
$message = "Hello $username, "
. "Your application was recieved successfully."
.""
.""
."Your username is $username"
."Your password is $password"
.""
."Thanks,"
." -Ben";
//send mail here
mail($to,$subject,$message, "From: [email]nexgen_x@hotmail.com[/email]", "nexgen_x@hotmail.com");
}
// functions (ErrorPage, PrintConfirm, PrintHeader & PrintFooter)
function ErrorPage($error) {
$title = "Error!";
PrintHeader($title);
Print "There was an error processing your application:";
Print "";
Print $error;
PrintFooter("");
}
function PrintConfirm ($encryptedpass) {
$title = "Confirmation";
PrintHeader($title);
Print "Your application was successfully processed. You should recieve an email with your application details in the next 24 hours.";
Print "Just for your amusement, your encrypted password is: $encryptedpass ."
//the line below is line 55 (well, 56 now, but y'know :P)
PrintFooter();
}
function PrintHeader($title) {
Print "<html>";
Print "<head><title>$title</title></head>";
Print "<body>";
}
function PrintFooter () {
Print "</body>";
Print "</html>";
}
?>