Jump to content

Parse error: syntax error, unexpected ':'


Jill78

Recommended Posts

Here is the code that Andy tried out (I think) and it worked for him, but I got an error on the line reading:  $posterstyle = $_POST['posterstyle'];

When I replaced the upper part with  extract($_POST), then I would get the error on this line:

mail("jillpearson@comcast.net", $subject, $msg, "Jill");



<?php

$visitor = $_POST['visitor'];
$visitoremail = $_POST['visitoremail'];
$visitorstreet = $_POST['visitorstreet'];
$visitorcity = $_POST['visitorcity'];
$visitorstate = $_POST['visitorstate'];
$visitorzipcode = $_POST['visitorzipcode'];
$paymentmethod = $_POST['paymentmethod'];
$posterstyle = $_POST['posterstyle'];
$posterline = $_POST['posterline'];
$playername = $_POST['playername'];
$colors = $_POST['colors'];
$maintext = $_POST['maintext'];
$smalltext = $_POST['smalltext'];
$playernumber = $_POST['playernumber'];     
$mainphoto = $_POST['mainphoto'];


if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
{
echo "<h2>Use Back - Enter valid e-mail</h2>\n";
$badinput = "<h2>Feedback was NOT submitted</h2>\n";
}
if(empty($visitor) || empty($visitormail) || empty($notes )) {
echo "<h2>Use Back - fill in all fields</h2>\n";
}
echo $badinput;

$todayis = date("l, F j, Y, g:i a") ;

$subject = $visitor;


$msg="
Name: $visitor \n
Email: $visitoremail \n
Street: $visitorstreet\n
City: $visitorcity \n
State: $visitorstreet \n
Zip Code: $visitorzipcode
Payment Method: $paymentmethod \n
Poster Style: $posterstyle \n
Poster Line: $posterline \n
Player Name: $playername \n
Colors: $colors \n
Main Text: $maintext \n
Small Text: $smalltext \n
Player Number: $playernumber \n
Main Photo: $mainphoto \n
Additional Info: IP = $ip \n
Browser Info: $httpagent \n
Referral: $httpref \n
";

mail("me@comcast.net", $subject, $msg, "Jill");
?>

<div align="center">Thank you for you order. If you do not receive personalized
  order confirmation from us within two business days, please call us at 555-555-5555.
</div>
<p align="center"> Date: <?php echo $todayis ?> <br />
  <?php echo $ip ?> <br />
  <br />
  <a href="sportsposters"> Next Page </a> </p>
Link to comment
Share on other sites

There's quite a few things that aren't quite right with the info that gets asked for and the info that gets sent, but that's all trivial stuff to fix later.

Fact is - it works on my server (from a client URL, but what the heck) - http://www.brianashton.ca/orderform.html - as you now know.

If you want to send me the complete order form and order form processing script (email to andy@halfadot.com), I'll get it working on my server and then - if needed - you can approach your web host and ask "how come this works on X and bombs on my server"
Link to comment
Share on other sites

Try replacing the whole thing with this and see if you are still getting similar errors.

[code]
<?php

extract($_POST);

if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
{
echo "<h2>Use Back - Enter valid e-mail</h2>\n";
$badinput = "<h2>Feedback was NOT submitted</h2>\n";
}
if(empty($visitor) || empty($visitormail) || empty($notes )) {
echo "<h2>Use Back - fill in all fields</h2>\n";
}
echo $badinput;

$todayis = date("l, F j, Y, g:i a") ;

$subject = $visitor;


$msg="
Name: $visitor \n
Email: $visitoremail \n
Street: $visitorstreet\n
City: $visitorcity \n
State: $visitorstreet \n
Zip Code: $visitorzipcode
Payment Method: $paymentmethod \n
Poster Style: $posterstyle \n
Poster Line: $posterline \n
Player Name: $playername \n
Colors: $colors \n
Main Text: $maintext \n
Small Text: $smalltext \n
Player Number: $playernumber \n
Main Photo: $mainphoto \n
Additional Info: IP = $ip \n
Browser Info: $httpagent \n
Referral: $httpref \n
";

mail("me@comcast.net", $subject, $msg, "Jill");

echo "<div align=\"center\">Thank you for you order. If you do not receive personalized
 order confirmation from us within two business days, please call us at 555-555-5555.
</div>
<p align=\"center\"> Date: $todayis
<a href=\"sportsposters\"> Next Page </a> </p> ";

?>
[/code]
Link to comment
Share on other sites

That gave me:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /export/home/ji/jill/public_html/consumerorder7.php on line 3

Whatever I had before was working on Andy's server.  So I guess this is an issue with my server at this point. I'll contact them.

Thanks all so much for your help.
Link to comment
Share on other sites

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.