Can someone look at this PHP Mail Form code and tell me what I have wrong? I am getting a parsing error on line 13. <? $Title = $_REQUEST['Title']; $URL = $_REQUEST['URL']; $Category = $_REQUEST['Category']; $Description = $_REQUEST['Description']; $Name = $_REQUEST['Name']; $Email = $_REQUEST['Email']; $URLExchange = $_REQUEST['URLExchange']; if (!isset($_REQUEST['$Email'])) { header("Location : http://www.quoteforinsurancedirectory.com/free-listing.html"); } elseif (empty($Title) || (empty($URL) || (empty($Description) || (empty($Name) || (empty($Email) || (empty($URLExchange)) { header ("Location : http://www.quoteforinsurancedirectory.com/form-error.html"); } else { mail("admin@quoteforinsurance.com", "Link Exchange Request", "Title: $Title/nURL: $URL/nCategory: $Category/nDescription: $Description/nContact Name: $Name/nContact Email: $Email/nURL of Link Exchange: $URLExchange/n", "From: $Email" ); header( "Location : http://www.quoteforinsurancedirectory.com/thank-you-request.html"); } ?>
} elseif (empty($Title) || (empty($URL) || (empty($Description) || (empty($Name) || (empty($Email) || (empty($URLExchange)) { PHP: should be } elseif ( (empty($Title)) || (empty($URL)) || (empty($Description)) || (empty($Name)) || (empty($Email)) || (empty($URLExchange)) ){ PHP: your parentheses are off...
So it should read as this? elseif (empty($Title) (empty($URL) (empty($Description) (empty($Name) (empty($Email) (empty($URLExchange) { header ("Location : http://www.quoteforinsurancedirectory.com/form-error.html"); }
I just used ifs....for each one, it may take a few more lines of code, but it work's...like if($description == ''){ echo "You need to fill in a description, go <a href=yourformpage.php>back</a>"; } That way you can specify which was left blank...
For every ( you nee to have a respective ). You have 12 left parens between elseif and the bracket. You only have 6 right parens. (empty($Title)) (empty($URL)) (empty($Description)) (empty($Name)) (empty($Email)) (empty($URLExchange)) PHP: Would be a good start, but you also need an additional set of () around the entire if statement: elseif ( // open paren (empty($Title)) || // conditional 1 (empty($URL)) || // conditional 2 (empty($Description)) || // conditional 3 (empty($Name)) || // conditional 4 (empty($Email)) || // conditional 5 (empty($URLExchange)) || // conditional 6 ) // close paren for elseif statement { header ("Location : http://www.quoteforinsurancedirectory.com/form-error.html"); } PHP: got it? edit: added ||s
I have the paren fixed as per your instructions. The error I am getting is this: Parse error: parse error, unexpected '{' in /home/quotefor/public_html/add-link.php on line 13 <? $Title = $_REQUEST['Title']; $URL = $_REQUEST['URL']; $Category = $_REQUEST['Category']; $Description = $_REQUEST['Description']; $Name = $_REQUEST['Name']; $Email = $_REQUEST['Email']; $URLExchange = $_REQUEST['URLExchange']; if ( !isset($_REQUEST['$Email'] ) { header("Location : http://www.quoteforinsurancedirectory.com/free-listing.html"); } elseif ( (empty($Title)) (empty($URL)) (empty($Description)) (empty($Name)) (empty($Email)) (empty($URLExchange)) ) { header ("Location : http://www.quoteforinsurancedirectory.com/form-error.html"); } else { mail("admin@quoteforinsurance.com", "Link Exchange Request", "Title: $Title/nURL: $URL/nCategory: $Category/nDescription: $Description/nContact Name: $Name/nContact Email: $Email/nURL of Link Exchange: $URLExchange/n", "From: $Email" ); header( "Location : http://www.quoteforinsurancedirectory.com/thank-you-request.html"); } ?>
The problem seems to be in the first part of the code: if ( !isset($_REQUEST['$Email'] ) { header("Location : http://www.quoteforinsurancedirectory.com/free-listing.html"); }