/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] unexpected $end no idea??

Hey everyone,
I feel completely lost over here because I dont know what my tag is that i’m missing. This is a short and to the point contact page that has a small form on it for the user to submit something too. there’s some validation in it so if something isn’t filled out the mail wont send and will repopulate whatever they user entered correctly. any help would be great.

thank you!
Nick G
here’s the code for the whole site, only about 60 lines

[CODE]<?php
include(‘header.inc.php’);
if(isset($_POST[‘submit’])){
$to= “[email protected]”;
$from = $_POST[‘CustEmail’];
$subject = $_POST[‘MailSubject’];
$name = $_POST[‘CustName’];
$msg = $_POST[‘comments’];
if(!$from){
$error[0] = “*”;
$count = $count + 1;
}else{
$_SESSION[‘from’] = $from;
}
if(!$subject){
$error[1] = “*”;
$count = $count + 1;
}else{
$_SESSION[‘subject’] = $subject;
}
if(!$name){
$error[2] = “*”;
$count = $count + 1;
}else{
$_SESSION[‘name’] = $name;
}
if(!$msg){
$error[3] = “*”;
$count = $count + 1;
}else{
$_SESSION[‘msg’] = $msg;
}
if(!$count){

$msg .= $name;
$msg .= $from;

mail($to, $subject, $msg);
}

}
?>
<div id=”content”>
<?php
if($count > 1){
echo “Please Correct the Following Errors”;
}else{

echo “<p>Please take the time to send in any questions/comments you might have regarding AllOutdoorRecreation.com, and we will be sure to answer them quickly and adequately.<br/>”;
echo “Thank you from AllOutdoorRecreation.com staff.</p>”;
?>
<table>
<form method=”post” action=”contactus.php”>
<tr><td><?php echo “<font color=’red’>” . $error[3] . “</font>”; ?>Name:</td><td> <input type=”text” name=”CustName” size=”25″ value=”<?php echo $_SESSION[‘name’];?>”/></td></tr>
<tr><td><?php echo “<font color=’red’>” . $error[0] . “</font>”; ?>E-Mail: </td><td><input type=”text” name=”CustEmail” size=”25″ value=”<?php echo $_SESSION[‘from’];?>”/></td></tr>
<tr><td><?php echo “<font color=’red’>” . $error[1] . “</font>”; ?>Subject: </td><td><input type=”text” name=”MailSubject” size=”25″ value=”<?php echo $_SESSION[‘subject’];?>”/></td></tr>
<tr><td><?php echo “<font color=’red’>” . $error[2] . “</font>”; ?>Questions/Comments: </td><td><textarea name=”comments” cols=40 rows=6><?php echo $_SESSION[‘msg’]; ?></textarea></td></tr>
<tr><td colspan=”2″><input type=”submit” name=”contact” value=”Contact Us”/></td></tr>
</form>
</table>
<!–end content section–>
</div>
<?php include(‘footer.inc.php’);?>[/CODE]

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@MindzaiDec 09.2009 — This error almost always indicates a missing brace, and sure enough you are missing one here:

[code=php]
<?php
if($count > 1){
echo "Please Correct the Following Errors";
}else{

echo "<p>Please take the time to send in any questions/comments you might have regarding AllOutdoorRecreation.com, and we will be sure to answer them quickly and adequately.<br/>";
echo "Thank you from AllOutdoorRecreation.com staff.</p>";
?>
[/code]


BTW this code could be re-written to be much simpler with a loop instead of all the repeated code.
Copy linkTweet thisAlerts:
@NickG21authorDec 09.2009 — Wow, that was way too simple, i'm at a loss for words on myself there lol. thanks for your help, coding at 12:30 at night after a long day might not be recommended for me anymore

Thanks again
×

Success!

Help @NickG21 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 5.15,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...