FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


PHP Parse error on form handling - New to PHP





welshsteve
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 http://swweb.frih.net/request.html 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 elseif (empty($email) || empty($tel)) || empty($rdate)) || empty($rtime)) || empty($contactname)) || empty($cusref)) {. 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 Sad

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" );
  }
 elseif (empty($email) || empty($tel)) || empty($rdate)) || empty($rtime)) || empty($contactname)) || empty($cusref)) {
    ?>

    <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" );
  }
?>


Many thanks in advance
hexkid
welshsteve wrote:
I'm getting a parse error on the line elseif (empty($email) || empty($tel)) || empty($rdate)) || empty($rtime)) || empty($contactname)) || empty($cusref)) {.


Count your parenthesis!


elseif (empty($email) || empty($tel)) || empty($rdate)) /*...*/ ) {


The red part above is outside the mandatory parenthesis of the if() construct.
welshsteve
hexkid wrote:
welshsteve wrote:
I'm getting a parse error on the line elseif (empty($email) || empty($tel)) || empty($rdate)) || empty($rtime)) || empty($contactname)) || empty($cusref)) {.


Count your parenthesis!


elseif (empty($email) || empty($tel)) || empty($rdate)) /*...*/ ) {


The red part above is outside the mandatory parenthesis of the if() construct.


AHA. I see what I've done now. I'm guessing it should be

elseif (empty($email) || empty($tel) || empty($rdate) || empty($rtime) || empty($contactname) || empty($cusref)) {
welshsteve
I've sorted this out now.

http://swweb.frih.net/request.html
Related topics
Help: SQL error after uploading new files(thread updated)
PHP/Blogger error
Impossible parse error!
Trouble figuring out a parse error
Parse error: syntax error, unexpected '{' in /home/frih/publ
Php parsing error! Need help
php error ?[parse error]
Parse error - need help
Parse error: syntax error, unexpected T_NEW
[PHP] Parse error
Parse Error in PHP I can't figure out.
Please can anyone help with a php script error/problem?
Cannot find parse error
Form handling in php is a pain in the neck
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.