/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] PHP Error: syntax error, unexpected T_STRING

I’m trying to resolve an error, but I’m still pretty new to PHP and I’m not sure how to correct what’s wrong, because I simply don’t see what’s wrong. I’m getting an parse error that says, “Parse error: syntax error, unexpected T_STRING on line 147

The code is:

[code=php] <?php
if (empty($_POST)) {
print “<p>Your data failed to submit. Please reattempt. Contact the administrator at [email protected] if failure continues to occur.</p>”;
print “</body></html>”;
exit();
}

function clear_user_input($value) {
if (get_magic_quotes_gpc()) $value=stripslashes($value);
$value= str_replace( “n”, ”, trim($value));
$value= str_replace( “r”, ”, $value);
return $value;
}

if ($_POST[‘comments’] == ‘Feel free to be open and honest. Share what you think.’) $_POST[‘comments’] = ”;

$body =”The user submitted the following information:n”;

foreach ($_POST as $key => $value) {
$key = clear_user_input($key);
$value = clear_user_input($value);
if ($key==’extras’) {

if (is_array($_POST[‘extras’]) ){
$body .= “$key: “;
$counter =1;
foreach ($_POST[‘extras’] as $value) {
//Add comma and space until last element
if (sizeof($_POST[‘extras’]) == $counter) {
$body .= “$valuen”;
break;}
else {
$body .= “$value, “;
$counter += 1;
}
}
} else {
$body .= “$key: $valuen”;
}
} else {

$body .= “$key: $valuen”;
}
}

extract($_POST);

$email = clear_user_input($email);
$name = clear_user_input($name);
$from=’From: ‘. $email . “(” . $name . “)” . “rn” . ‘Bcc: [email protected] . “rn”;
$subject = ‘LMCO Contact Form’;
mail (‘[email protected]’, $subject, $body, $from);
?>[/code]

Line 147 being the $subject = ‘LMCO Contact Form’;

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@BrainDonorAug 07.2008 — check your quotes and ticks on the previous line.
Copy linkTweet thisAlerts:
@HjaiauthorAug 07.2008 — check your quotes and ticks on the previous line.[/QUOTE]

Ah ha! Such a simple solution! Thank you. It's working great now. You're a code saving hero ?
Copy linkTweet thisAlerts:
@BrainDonorAug 08.2008 — Glad to help. ?
×

Success!

Help @Hjai spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...