October 25, 201213 yr I cannot continue with my lessons until I figure out what is wrong with this bit of code.It is not very long and this is the error I get Parse error: parse error, unexpected ';' in C:\htdocs\phpdw\contact.php on line 2 <?php if(array_key_exists('ewcomments',$_POST); ( echo 'you clicked the submit button' ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[url="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"]http://www.w3.org/TR...ransitional.dtd[/url] <html xmlns="[url="http://www.w3.org/1999/xhtml%22>"]http://www.w3.org/1999/xhtml">[/url] <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>east west seasons</title> <?php /*include('style_rules.php');*/ ?> </head> <body> <div id="wrapper"> <div id="titlebar"><img src="" alt="east west season" name="bluebellstop" width="738" height="32" id="bluebellstop" style="background-color: #00CC99" /></div> <div id="Main content"> <div id="nav"> <ul> <li id="thispage"><a href="index.php">Home</a></li> <li><a href="index.php">News</a></li> <li><a href="index.php">BLog</a></li> <li><a href="index.php">Gallery</a></li> <li><a href="index.php">Contact</a></li> </ul> </div> <h1>send us your comments</h1> <p>Duis aute irure dolor ut labore et dolore magna aliqua. Quis nostrud exercitation sunt in culpa lorem ipsum dolor sit amet. Excepteur sint occaecat ullamco laboris nisi ut labore et dolore magna aliqua. In reprehenderit in voluptate quis nostrud exercitation qui officia deserunt. </p><form action="<?php $_SERVER['PHP_SELF'];?>" method="post" name="Contact form" id="Contact form"> <p> <label for="name">name:</label> <br /> <input type="text" name="name" id="name" /> </p> <p> <label for="email">email</label> <br /> <input type="text" name="email" id="email" /> </p> <p> <label for="message">message<br /> </label> <textarea name="message" cols="60" rows="6" id="message"></textarea> </p> <p> <input name="ewcomments" type="submit" id="ew comments" value="send comments" /> </p> </form> <p> </p> <div id="footer"> <?php include('copyright.php'); ?> </div> </div> </div> </body> </html> Edited October 25, 201213 yr by Renaissance-Design Code formatting
October 25, 201213 yr <?php if(array_key_exists('ewcomments',$_POST)) { echo 'you clicked the submit button'; } ?>
October 25, 201213 yr Firstly, if you're going to post code on the forum, use the code button - it's the one that looks like this: <> Secondly, as Leonw pointed out you have an unclosed parenthesis on Line 2. In addition, conditionals use curly braces not parentheses and are not terminated with a semicolon. Edited October 25, 201213 yr by Renaissance-Design
October 25, 201213 yr Replace your first four lines with this piece of code: <?php if(array_key_exists('ewcomments',$_POST)) { echo 'you clicked the submit button' ;} ?> That will get rid of your error message. Edited October 25, 201213 yr by AnnobilsWebDesign
October 25, 201213 yr Author Thank you guys.I still have so much to learn but I decided to read another book in addition to the one I am reading now.The one I am reading now covers php in dreamweaver but I am going to start reading one about only php and learn to hand code everything.I will save this page and try the code tommorrow
Create an account or sign in to comment