/    Sign up×
Community /Pin to ProfileBookmark

PHP Parse error on form handling – New to PHP

Hi. I’m new to PHP and am trying to use it to handle a form request on a test website I’m building. The address of the HTML form is [url]http://swweb.frih.net/request.html[/url] and the php to handle it is below. Basically, I want the details specified in the form to be e-mailed to the supplied e-mail address. However, I’m getting a parse error on the line in red below. Anyone know why? I can’t see the problem, although, as I have said, I’m new to PHP so have probably done something stupid ?

[code]
<?
$cusref = $_REQUEST[‘cusref’] ;
$contactname = $_REQUEST[‘contactname’] ;
$tel = $_REQUEST[‘tel’] ;
$email = $_REQUEST[’email’] ;
$rdate = $_REQUEST[‘rdate’] ;
$rtime = $_REQUEST[‘rtime’] ;

if (!isset($_REQUEST[’email’])) {
header( “Location: request.html” );
}
[COLOR=”Red”]elseif (empty($email) || empty($tel)) || empty($rdate)) || empty($rtime)) || empty($contactname)) || empty($cusref)) {[/COLOR]
?>

<html>
<head><title>Error</title></head>
<body>
<h1>Error</h1>
<p>
Not all field have been filled in. Please try again.
</p>
</body>
</html>

<?
}
else {
mail( “$email”, “Collection order confirmation”,
“From: Phones 4 Charity” ), “Customer Reference: $cusref”, “Contact Name: $contactname”, “Telephone: $tel”, “Requested Date: $rdate”, “Requested Time: $rtime” ;
header( “Location: thanks.html” );
}
?>
[/code]

Many thanks in advance

[b]EDIT[/b]
I see what I’ve done now. I’ve doubled up on brackets/parenthesis. Is the below correct?

[COLOR=Red]elseif (empty($email) || empty($tel) || empty($rdate) || empty($rtime) || empty($contactname) || empty($cusref)) {[/COLOR]

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@NogDogDec 06.2006 — That looks better, but I think your mail() command will fail, as it has too many parameters and the closing ")" in the middle of the parameter list.
Copy linkTweet thisAlerts:
@WelshsteveauthorDec 07.2006 — Yeah I spotted that. I have it working now. See http://swweb.frih.net/request.html
×

Success!

Help @Welshsteve 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.26,
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,
)...