•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 422,998 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,863 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 2191 | Replies: 4
![]() |
•
•
Join Date: Jun 2006
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
Hi
I am getting this error on our website that was created by somebody else.
Parse error: parse error, unexpected T_STRING in /var/www-virtual/www.fpis.co.nz/pages/fpis_contact.php on line 5
This is the complete code that was created and I am trying to fix it and don't have a clue what is wrong
<?
$to = "reception@fpis.co.nz";
$subject = "Message from the FPIS Contact Page";
$msg = "Title: $contact_gendertitle\n\n;
$msg = "First Name: $contact_firstname\n\n;
$msg = "Surname: $contact_surname\n\n;
$msg = "Street Address: $contact_streetadd\n\n;
$msg = "Suburb: $contact_suburb\n\n;
$msg = "City or Town: $contact_city_town\n\n;
$msg = "Zip or Postcode: $contact_zip_postcode\n\n;
$msg = "Province or State: $contact_province_state\n\n;
$msg = "Country: $contact_country\n\n;
$msg = "Company: $contact_company\n\n;
$msg = "Position: $contact_position\n\n;
$msg = "Home Phone: $contact_homephone\n\n;
$msg = "Business Phone: $contact_busphone\n\n;
$msg = "Mobile Phone: $contact_mobilephone\n\n;
$msg = "Fax Number: $contact_fax\n\n;
$msg = "E-mail Address: $contact_email\n\n;
$msg = "Message: $contact_message\n\n;
mail ($to, $subject, $msg, "Message from the Contact Page");
?>
This is suppose to email a message to our reception e-mail with all the details that was entered on the web page
Can you please help me to fix this
Regards
Casper
I am getting this error on our website that was created by somebody else.
Parse error: parse error, unexpected T_STRING in /var/www-virtual/www.fpis.co.nz/pages/fpis_contact.php on line 5
This is the complete code that was created and I am trying to fix it and don't have a clue what is wrong
<?
$to = "reception@fpis.co.nz";
$subject = "Message from the FPIS Contact Page";
$msg = "Title: $contact_gendertitle\n\n;
$msg = "First Name: $contact_firstname\n\n;
$msg = "Surname: $contact_surname\n\n;
$msg = "Street Address: $contact_streetadd\n\n;
$msg = "Suburb: $contact_suburb\n\n;
$msg = "City or Town: $contact_city_town\n\n;
$msg = "Zip or Postcode: $contact_zip_postcode\n\n;
$msg = "Province or State: $contact_province_state\n\n;
$msg = "Country: $contact_country\n\n;
$msg = "Company: $contact_company\n\n;
$msg = "Position: $contact_position\n\n;
$msg = "Home Phone: $contact_homephone\n\n;
$msg = "Business Phone: $contact_busphone\n\n;
$msg = "Mobile Phone: $contact_mobilephone\n\n;
$msg = "Fax Number: $contact_fax\n\n;
$msg = "E-mail Address: $contact_email\n\n;
$msg = "Message: $contact_message\n\n;
mail ($to, $subject, $msg, "Message from the Contact Page");
?>
This is suppose to email a message to our reception e-mail with all the details that was entered on the web page
Can you please help me to fix this
Regards
Casper
•
•
Join Date: Jul 2004
Location: Sydney, Australia
Posts: 166
Reputation:
Rep Power: 5
Solved Threads: 7
The error is generated from the line of code before because you have an unclosed string marker - "
You will get the same error for every other line in that code as well as they all contain the same unclosed string marker error. To fix, on every line of $msg code you will need to close the string, and also concatenate the variable with the string. You will also need to concatenate all of the $msg values together as well, otherwise the output from the $msg variable will only be the last value you assign to it.
So, to get you started:
[php]$msg = "Title: " . $contact_gendertitle\n\n;
$msg .= "First Name: " . $contact_firstname\n\n;
$msg .= "Surname: " . $contact_surname\n\n;[/php]
Copy that pattern down through the rest of the lines and all should be well.
You will get the same error for every other line in that code as well as they all contain the same unclosed string marker error. To fix, on every line of $msg code you will need to close the string, and also concatenate the variable with the string. You will also need to concatenate all of the $msg values together as well, otherwise the output from the $msg variable will only be the last value you assign to it.
So, to get you started:
[php]$msg = "Title: " . $contact_gendertitle\n\n;
$msg .= "First Name: " . $contact_firstname\n\n;
$msg .= "Surname: " . $contact_surname\n\n;[/php]
Copy that pattern down through the rest of the lines and all should be well.
If I've been a help please confirm by clicking the Add to Lafinboy's Reputation link in the header of this reply.
Lafinboy Productions
:: Website Design :: Website Development ::
Lafinboy Productions
:: Website Design :: Website Development ::
•
•
Join Date: Jun 2006
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
Thanx for the feeback Lafinboy, made the changes and now I get these errors could you assist me in this
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /var/www-virtual/www.fpis.co.nz/pages/fpis_contact.php on line 4
Parse error: parse error, unexpected T_STRING in /var/www-virtual/www.fpis.co.nz/pages/fpis_contact.php on line 4
<?
$to = "karen@fpis.co.nz";
$subject = "Message from the FPIS Contact Page";
$msg = "Title:" . $contact_gendertitle\n\n;
$msg .= "First Name:" . $contact_firstname\n\n;
$msg .= "Surname:" . $contact_surname\n\n;
$msg .= "Street Address:" . $contact_streetadd\n\n;
$msg .= "Suburb:" . $contact_suburb\n\n;
$msg .= "City or Town:" . $contact_city_town\n\n;
$msg .= "Zip or Postcode:" . $contact_zip_postcode\n\n;
$msg .= "Province or State:" . $contact_province_state\n\n;
$msg .= "Country:" . $contact_country\n\n;
$msg .= "Company:" . $contact_company\n\n;
$msg .= "Position:" . $contact_position\n\n;
$msg .= "Home Phone:" . $contact_homephone\n\n;
$msg .= "Business Phone:" . $contact_busphone\n\n;
$msg .= "Mobile Phone:" . $contact_mobilephone\n\n;
$msg .= "Fax Number:" . $contact_fax\n\n;
$msg .= "E-mail Address:" . $contact_email\n\n;
$msg .= "Message:" . $contact_message\n\n;
mail ($to, $subject, $msg, "Message from the Contact Page");
?>
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /var/www-virtual/www.fpis.co.nz/pages/fpis_contact.php on line 4
Parse error: parse error, unexpected T_STRING in /var/www-virtual/www.fpis.co.nz/pages/fpis_contact.php on line 4
<?
$to = "karen@fpis.co.nz";
$subject = "Message from the FPIS Contact Page";
$msg = "Title:" . $contact_gendertitle\n\n;
$msg .= "First Name:" . $contact_firstname\n\n;
$msg .= "Surname:" . $contact_surname\n\n;
$msg .= "Street Address:" . $contact_streetadd\n\n;
$msg .= "Suburb:" . $contact_suburb\n\n;
$msg .= "City or Town:" . $contact_city_town\n\n;
$msg .= "Zip or Postcode:" . $contact_zip_postcode\n\n;
$msg .= "Province or State:" . $contact_province_state\n\n;
$msg .= "Country:" . $contact_country\n\n;
$msg .= "Company:" . $contact_company\n\n;
$msg .= "Position:" . $contact_position\n\n;
$msg .= "Home Phone:" . $contact_homephone\n\n;
$msg .= "Business Phone:" . $contact_busphone\n\n;
$msg .= "Mobile Phone:" . $contact_mobilephone\n\n;
$msg .= "Fax Number:" . $contact_fax\n\n;
$msg .= "E-mail Address:" . $contact_email\n\n;
$msg .= "Message:" . $contact_message\n\n;
mail ($to, $subject, $msg, "Message from the Contact Page");
?>
•
•
Join Date: Jul 2004
Location: Sydney, Australia
Posts: 166
Reputation:
Rep Power: 5
Solved Threads: 7
Again, simple string concatenation errors. The following will work.
[php] <?
$to = "karen@fpis.co.nz";
$subject = "Message from the FPIS Contact Page";
$msg = "Title:" . $contact_gendertitle . "\n\n";
$msg .= "First Name:" . $contact_firstname . "\n\n";
$msg .= "Surname:" . $contact_surname . "\n\n";
$msg .= "Street Address:" . $contact_streetadd . "\n\n";
$msg .= "Suburb:" . $contact_suburb . "\n\n";
$msg .= "City or Town:" . $contact_city_town . "\n\n";
$msg .= "Zip or Postcode:" . $contact_zip_postcode . "\n\n";
$msg .= "Province or State:" . $contact_province_state . "\n\n";
$msg .= "Country:" . $contact_country . "\n\n";
$msg .= "Company:" . $contact_company . "\n\n";
$msg .= "Position:" . $contact_position . "\n\n";
$msg .= "Home Phone:" . $contact_homephone . "\n\n";
$msg .= "Business Phone:" . $contact_busphone . "\n\n";
$msg .= "Mobile Phone:" . $contact_mobilephone . "\n\n";
$msg .= "Fax Number:" . $contact_fax . "\n\n";
$msg .= "E-mail Address:" . $contact_email . "\n\n";
$msg .= "Message:" . $contact_message . "\n\n";
mail ($to, $subject, $msg, "Message from the Contact Page");
?>[/php]
[php] <?
$to = "karen@fpis.co.nz";
$subject = "Message from the FPIS Contact Page";
$msg = "Title:" . $contact_gendertitle . "\n\n";
$msg .= "First Name:" . $contact_firstname . "\n\n";
$msg .= "Surname:" . $contact_surname . "\n\n";
$msg .= "Street Address:" . $contact_streetadd . "\n\n";
$msg .= "Suburb:" . $contact_suburb . "\n\n";
$msg .= "City or Town:" . $contact_city_town . "\n\n";
$msg .= "Zip or Postcode:" . $contact_zip_postcode . "\n\n";
$msg .= "Province or State:" . $contact_province_state . "\n\n";
$msg .= "Country:" . $contact_country . "\n\n";
$msg .= "Company:" . $contact_company . "\n\n";
$msg .= "Position:" . $contact_position . "\n\n";
$msg .= "Home Phone:" . $contact_homephone . "\n\n";
$msg .= "Business Phone:" . $contact_busphone . "\n\n";
$msg .= "Mobile Phone:" . $contact_mobilephone . "\n\n";
$msg .= "Fax Number:" . $contact_fax . "\n\n";
$msg .= "E-mail Address:" . $contact_email . "\n\n";
$msg .= "Message:" . $contact_message . "\n\n";
mail ($to, $subject, $msg, "Message from the Contact Page");
?>[/php]
If I've been a help please confirm by clicking the Add to Lafinboy's Reputation link in the header of this reply.
Lafinboy Productions
:: Website Design :: Website Development ::
Lafinboy Productions
:: Website Design :: Website Development ::
•
•
Join Date: Jun 2006
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
Thanx again, it's working but the problem now is that it does not pull through the info in the open blocks where you enter the details from the html form from where it collects this info.Any ideas what I need to fix.
One more question when this php code has run the page stays blank while it send the info, what code can I add to take you back to the main page and to thank the user for the info they have entered. Cheers Casper
One more question when this php code has run the page stays blank while it send the info, what code can I add to take you back to the main page and to thank the user for the info they have entered. Cheers Casper
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- parse error, unexpected T_STRING in (PHP)
- Parse error: parse error, unexpected T_STRING on line 12 (PHP)
- PHP Parse error: parse error, unexpected T_STRING in F:\downloads\cats-0.6.1\index.ph (PHP)
- Please Help! parse error, unexpected T_STRING (PHP)
- Parse Error T_STRING - Help Please (PHP)
- PHP Parse error: parse error, unexpected T_STRING (PHP)
- Parse error: parse error, unexpected T_STRING in /home/thei2k9/public_html/includes/f (PHP)
Other Threads in the PHP Forum
- Previous Thread: You have not selected search details.
- Next Thread: PHP welcome message in viewer's language ???


Linear Mode