Jump to content

Recommended Posts

Getting the following error message: Parse error: syntax error, unexpected $end in /Applications/XAMPP/xamppfiles/htdocs/Testsite/emailto.php on line 3

 

Here is the code:

 

<form method="post" action="">

<table border="1" width="25%">

<tr>

<td width="10">To:</td><td><input type="text" name="to" size="20" value="<?php echo $_REQUEST['emails'];?>"></td></tr>

<td width="10">Subject:</td><td><input type="text" name="subject" size="20"></td></tr>

<tr>

<td width="10">Message:</td><td><textarea name="message" cols="30" rows="3"></textarea>

</tr>

</table>

<p><input type="submit" name="submit" value="send email"><p>

</form>

<?php

 

if(isset($_REQUEST['submit'])){

 

$to = $_REQUEST['to'];

$subject = $_REQUEST['subject'];

$body = $_REQUEST['message'];

$from = "admin@ryantutorials.com";

$headers = "From: $from";

 

if($to && $subject && $body){

 

mail($to,$subject,$body,$headers);

echo "your email has been sent";

header("Refresh:5; url=update.php");

}else{

echo "Please fill out all fields";

 

}

?>

 

Link to comment
https://forums.phpfreaks.com/topic/272156-unexpected-syntax-error/
Share on other sites

Jessica is quite right, you are missing a closing }.

 

If you indent your code, it will make it easier to see when you have opened a { and then closed it }. This is a common mistake for me when using if statements.

 

Welcome to the Forum!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.