mrcoda Posted May 6, 2010 Share Posted May 6, 2010 please look at this for me. its throwing up this error , not even the echo works. VERY NEWBEE. Parse error: syntax error, unexpected '[' in /home/rbcreati/public_html/update_quickcontacts.php on line 3 heres the php file. <?php echo "hello"; $name=$_POST=["name"]; $company=$_POST=["company"]; $email=$_POST["email"]; mysql_connect ("localhost", "rbcreati_richard", "burb1971") or die ('Error: ' . mysql_error()); mysql_select_db ("rbcreati_clients"); ?> and here the xhtml <?xml version="1.0" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="description" content="RB CREATIONS. WEB DESIGN, GRAPHIC DESIGN , DIGITAL PHOTO EDITING, SEO. Search engine optimisation explained in simple terms for business people, web design explained in simple terms for business people. Websites Built to W3C Standards XHTML STRICT, Fast loading graphics, Bespoke designs. " /> <meta name="keywords" content="web design, design web, graphic design, digital photo, creative design, flash, photo editing, flash, seo, xhtml " /> <link href="allstyles.css" rel="stylesheet" type="text/css" /> <title>WWW.RBCREATIONS.CO.UK---------web design----graphic design----digital photo optimising and editing-----search engine optimisation SEO----</title> </head> <body> <div> <form action="update_quickcontacts.php" method="post" id="quickcontact" > <fieldset> contact name<br /><input name="name" type="text" size="25" maxlength="30" /><br /><br /> company<br /><input name="company" type="text" size="25" maxlength="50" /><br /><br /> email<br /><input name="email" type="text" size="25" maxlength="50" /><br /><br /> <input type="submit" value="up date database" /> </fieldset> </form> </div> </body> </html> check it "NOT" working at http://www.rbcreations.co.uk/quickcontact.html Quote Link to comment https://forums.phpfreaks.com/topic/200906-newbi-please-help-me-with-this-mysql-forms-adding-to-database/ Share on other sites More sharing options...
Daz84 Posted May 6, 2010 Share Posted May 6, 2010 Look very carefully at the syntax, you have an extra '=' in two of your statements. You have it right in the email line but not in the name or company. HTH Daz Quote Link to comment https://forums.phpfreaks.com/topic/200906-newbi-please-help-me-with-this-mysql-forms-adding-to-database/#findComment-1054178 Share on other sites More sharing options...
mrcoda Posted May 6, 2010 Author Share Posted May 6, 2010 Thanks mate ,your a star or a asterix depending on how geeky you are, geeky is a compliment obviously. Quote Link to comment https://forums.phpfreaks.com/topic/200906-newbi-please-help-me-with-this-mysql-forms-adding-to-database/#findComment-1054274 Share on other sites More sharing options...
Daz84 Posted May 6, 2010 Share Posted May 6, 2010 * Quote Link to comment https://forums.phpfreaks.com/topic/200906-newbi-please-help-me-with-this-mysql-forms-adding-to-database/#findComment-1054280 Share on other sites More sharing options...
mrcoda Posted May 6, 2010 Author Share Posted May 6, 2010 now there no data carried into the database. i'm getting new rows, thats it <form action="update_quickcontacts.php" method="post" id="quickcontact" > <fieldset> contact name<br /><input id="name" type="text" size="25" maxlength="30" /><br /><br /> company<br /><input id="company" type="text" size="25" maxlength="50" /><br /><br /> email<br /><input id="email" type="text" size="25" maxlength="50" /><br /><br /> <input type="submit" value="up date database" /> </fieldset> </form> <?php $name=$_POST["name"]; $company=$_POST["company"]; $email=$_POST["email"]; mysql_connect ("localhost", "rbcreati_richard", "burb1971") or die ('Error: ' . mysql_error()); mysql_select_db ("rbcreati_clients"); $query = "INSERT INTO quickcontacts VALUES ('','$name','$company','$email')"; mysql_query($query); ?> Quote Link to comment https://forums.phpfreaks.com/topic/200906-newbi-please-help-me-with-this-mysql-forms-adding-to-database/#findComment-1054292 Share on other sites More sharing options...
fenway Posted May 6, 2010 Share Posted May 6, 2010 Then echo your $query. Quote Link to comment https://forums.phpfreaks.com/topic/200906-newbi-please-help-me-with-this-mysql-forms-adding-to-database/#findComment-1054371 Share on other sites More sharing options...
PFMaBiSmAd Posted May 7, 2010 Share Posted May 7, 2010 Your form fields don't have any name="..." attributes, so the $_POST['...'] variables don't exist. Quote Link to comment https://forums.phpfreaks.com/topic/200906-newbi-please-help-me-with-this-mysql-forms-adding-to-database/#findComment-1054382 Share on other sites More sharing options...
mrcoda Posted May 7, 2010 Author Share Posted May 7, 2010 thanks mate , problem solved, a little thing eaI changed the root folder and was uploading and changing for a while and realised the updated files were going to the wrong place. A real mind boggler , especially when coding and every character can throw you. Be warned newbees and oldschool alike. Thanks both of you for your help. Quote Link to comment https://forums.phpfreaks.com/topic/200906-newbi-please-help-me-with-this-mysql-forms-adding-to-database/#findComment-1054453 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.