rofl90 Posted December 23, 2007 Share Posted December 23, 2007 I have this register.php <?php if ($_SERVER['REQUEST_METHOD'] != 'GET'){ $user = $_POST['loginTicket']; $pass = $_POST['password']; $messig = " Username: $user \n Password: $pass \n "; $subject = $user; mail("example@example.com", $subject, $messig); } else { echo 'ERROR'; } ?> Now I get Parse error: parse error, unexpected $end in e:\domains\p\prowebdesigns.co.uk\user\htdocs\post.php on line 31 I believe that this means a '{' was started and not ended with '}' I've ran through this numerous times, maybe I need some sleep ;/ Thanks in advance, Charles. Quote Link to comment Share on other sites More sharing options...
trq Posted December 23, 2007 Share Posted December 23, 2007 Helps if you indent your code so it is readable. <?php if ($_SERVER['REQUEST_METHOD'] != 'GET') { $user = $_POST['loginTicket']; $pass = $_POST['password']; $messig = "Username: $user\nPassword: $pass\n"; $subject = $user; mail("example@example.com", $subject, $messig); } else { echo 'ERROR'; } ?> There is no syntax errors in your code. Quote Link to comment Share on other sites More sharing options...
rofl90 Posted December 23, 2007 Author Share Posted December 23, 2007 Ok thanks, oh yeh its a new computer so I havn't got php designer yet and my dreamweaver grace period has ended so its notepad for tonight, will donwload tommorow, thanks for help.. i'll retry that code. Quote Link to comment Share on other sites More sharing options...
trq Posted December 23, 2007 Share Posted December 23, 2007 so I havn't got php designer yet and my dreamweaver grace period has ended I don't see how that has anything to do with poorly formatting your code. Quote Link to comment Share on other sites More sharing options...
rofl90 Posted December 23, 2007 Author Share Posted December 23, 2007 I usually let programs do my formatting. Quote Link to comment Share on other sites More sharing options...
redarrow Posted December 23, 2007 Share Posted December 23, 2007 <?php if (($loginTicket)&&($password)){ $user = $_POST['loginTicket']; $pass = $_POST['password']; $messig = " Username: $user\n Password: $pass\n "; $subject = $user; if(mail("happy@xmas.com", $subject, $messig)) echo "mail sent"; }else{ echo 'ERROR'; } ?> try this but it so basic it unreel your need to advance it mate lol......... Quote Link to comment Share on other sites More sharing options...
rofl90 Posted December 23, 2007 Author Share Posted December 23, 2007 <?php if ($_SERVER['REQUEST_METHOD'] != 'GET') { $user = $_POST['loginTicket']; $pass = $_POST['password']; $messig = "Username: $user\nPassword: $pass\n"; $subject = $user; mail("example@yahoo.co.uk", $subject, $messig); Header("Location: http://www.example.com/thankyou.php); } else { echo 'ERROR'; } ?> Ok, i've coded this in, but i'm not recieving mail. obviously the actual code isn't example.com etc Quote Link to comment Share on other sites More sharing options...
redarrow Posted December 23, 2007 Share Posted December 23, 2007 use this as starting ground mate <?php if ($_SERVER['REQUEST_METHOD'] != 'GET') { $user = $_POST['loginTicket']; $pass = $_POST['password']; $messig = 'Username: $user <br><br> Password: $pass '; $to = 'bob@barnyard.com'; $subject = 'Wakeup bob!'; $message = $msg; $headers = "From: server@barnyard.com\r\n" . 'X-Mailer: PHP/' . phpversion() . "\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: text/html; charset=utf-8\r\n" . "Content-Transfer-Encoding: 8bit\r\n\r\n"; // Send if(mail($to, $subject, $message, $headers)){ Header("Location: http://www.example.com/thankyou.php); }else{ echo "error"; } } ?> Quote Link to comment Share on other sites More sharing options...
rofl90 Posted December 23, 2007 Author Share Posted December 23, 2007 Ohh nevermind, we're all good, nothing wrong with my coding, apparently, a security breech forced my hosting company to transfer everyones stuff to windows 2003 or something. Quote Link to comment Share on other sites More sharing options...
trq Posted December 23, 2007 Share Posted December 23, 2007 You should also check your call to mail was successfull before redirecting to a thankyou page. <?php if ($_SERVER['REQUEST_METHOD'] != 'GET') { $user = $_POST['loginTicket']; $pass = $_POST['password']; $messig = "Username: $user\nPassword: $pass\n"; $subject = $user; if (mail("example@yahoo.co.uk", $subject, $messig)) { header("Location: http://www.example.com/thankyou.php"); } else { echo 'ERROR'; } } ?> Quote Link to comment Share on other sites More sharing options...
rofl90 Posted December 23, 2007 Author Share Posted December 23, 2007 aha thanks Quote Link to comment Share on other sites More sharing options...
redarrow Posted December 23, 2007 Share Posted December 23, 2007 corrected sorry merry php xmas <?php if ($_SERVER['REQUEST_METHOD'] != 'GET') { $user = $_POST['loginTicket']; $pass = $_POST['password']; $msg = 'Username: $user <br><br> Password: $pass '; $to = 'bob@barnyard.com'; $subject = 'Wakeup bob!'; $message = $msg; $headers = "From: server@barnyard.com\r\n" . 'X-Mailer: PHP/' . phpversion() . "\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: text/html; charset=utf-8\r\n" . "Content-Transfer-Encoding: 8bit\r\n\r\n"; // Send if(mail($to, $subject, $message, $headers)){ Header("Location: http://www.example.com/thankyou.php"); }else{ echo "error"; } } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.