Parse error: syntax error, unexpected T_STRING
Posted: Wed Jun 29, 2011 1:44 pm
Hello, I'm new to your forums. I've been working on a simple (or so I thought) php form. I have to be honest in saying that I found the code online in a tutorial and have tried to configure it too my own needs by deleting some of the fields that were present and replacing them with my own. I'm getting the following error message and would greatly appreciate your help!
Error:
Parse error: syntax error, unexpected T_STRING in /home/content/32/4805732/html/contactcma.php on line 10
Here's the php file:
- - - - - - - - - - - - - - - - -
thanks!
Linda
Error:
Parse error: syntax error, unexpected T_STRING in /home/content/32/4805732/html/contactcma.php on line 10
Here's the php file:
Code: Select all
<?php
/* Set e-mail recipient */
$myemail = "you@domain.com";
/* Check all form inputs using check_input function */
$name = check_input($_POST['name'], "Enter your name");
$address = check_input($_POST['address'], "Enter your address");
$city = check_input($_POST['city'], "Enter your city");
$state = check_input($_POST['state'], "Enter your state");
$zip code = check_input($_POST['zip code'], "Enter your zip code");
$email = check_input($_POST['email']);
$phone = check_input($_POST['phone'], "Enter your phone number");
/* If e-mail is not valid show error message */
if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email))
{
show_error("E-mail address not valid");
}
/* Let's prepare the message for the E-mail */
$message = "Hello!
Your contact form has been submitted by:
Name: $name
E-mail: $email
/* Send the message using mail() function */
mail($myemail, $subject, $message);
/* Redirect visitor to the thank you page */
header('Location: thanks_cma_request.html');
exit();
/* Functions we used */
function check_input($data, $problem='')
{
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
if ($problem && strlen($data) == 0)
{
show_error($problem);
}
return $data;
}
function show_error($myError)
{
?>
<html>
<body>
<b>Please correct the following error:</b><br />
<?php echo $myError; ?>
</body>
</html>
<?php
exit();
}
?>
thanks!
Linda