rscott7706 Posted May 18, 2006 Share Posted May 18, 2006 Have you ever had a coding job that worked the first time???? <Don't answer - especially if it's "Yes">.I know it is probably a dumb little mistake - but I have looked at it so many times I am going cross-eyed.I am building a form that uploads records through PHP to MYSQL. I found the scripts here (very simple basic stuff):[a href=\"http://www.freewebmasterhelp.com/tutorials/phpmysql/4\" target=\"_blank\"]http://www.freewebmasterhelp.com/tutorials/phpmysql/4[/a]I think I coded my stuff the same as the examples, but it doesn't work. I get this error message:Parse error: parse error, unexpected '=' in /home/lakeside/public_html/php/insert.php on line 26(line 26 matches the php code below: $E-mail_Address=$_POST['E-mail_Address'];)Be aware I put some hard returns here so it doesn't mess you folks up viewing it on the forum. Soif you want the original code without breaks, I can supply it.Thanks for any help in advance!! [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /] Here is the code (PHP/HTML first then HTML form):[!--sizeo:1--][span style=\"font-size:8pt;line-height:100%\"][!--/sizeo--]PHP / HTML[!--sizec--][/span][!--/sizec--]==============================================================<html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><title>Lakesie Chamber - Data Entry Form</title></head><body><?$username="lakeside_rscott";$password="";$database="lakeside_chamber";$Company_Name=$_POST['Company_Name'];$Business_Category=$_POST['Business_Category'];$Directory_Catagory=$_POST['Directory_Catagory'];$Description_of_Business=$_POST['Description_of_Business'];$Address=$_POST['Address'];$City=$_POST['City'];$State=$_POST['State'];$Zip_Code=$_POST['Zip_Code'];$First_Name=$_POST['First_Name'];$Last_Name=$_POST['Last_Name'];$Phone_Number=$_POST['Phone_Number'];$Website_Site_Address=$_POST['Web_Site_Address'];$E-mail_Address=$_POST['E-mail_Address'];mysql_connect(localhost,$username,$password);@mysql_select_db($database) or die( "Unable to select database");$query = "INSERT INTO members VALUES ('','$Company_Name','$Business_Category','$Directory_Category','$Description_of_Business','$Address','$City','$State','$Zip_Code','$First_Name','$Last_Name','$Phone_Number','$Web_Site_Address','$E-mail_Address')";mysql_query($query);mysql_close();?></body></html>=====================================================[!--sizeo:1--][span style=\"font-size:8pt;line-height:100%\"][!--/sizeo--]HTML / Form[!--sizec--][/span][!--/sizec--]=====================================================<html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><title>Data Entry Form</title> <style type="text/css"> <!-- BODY { font-family: arial, verdana, helvetica, sans-serif; font-size: small; color: Maroon; } P { font-family: arial, verdana, helvetica, sans-serif; font-size: small; color: Maroon; } TD { font-family: arial, verdana, helvetica, sans-serif; font-size: small; color: Navy; } TD.N { font-family: arial, verdana, helvetica, sans-serif; font-size: small; color: Maroon; } TD.G { font-family: arial, verdana, helvetica, sans-serif; font-size: small; color: Gray; } TD.S { font-family: arial, verdana, helvetica, sans-serif; font-size: small; color: Silver; } H1 { font-family: arial, verdana, helvetica, sans-serif; font-size: medium; color: Navy; font-weight : bold; margin-top : 0; margin-bottom : 0; margin : 0px 0px 0px 0px; } H2 { font-family: arial, verdana, helvetica, sans-serif; font-size: x-small; color: Maroon; font-weight : bold; margin-top : 0; margin-bottom : 0; margin : 0px 0px 0px 0px; } A { color: #0000FF; text-decoration: none; } A:visited { color: #3344FF; text-decoration: none; } A:hover { color: #CC0033; text-decoration : underline; background-color:#E6E9FE; } SMALL.x { font-size : small; } SMALL.xg { font-size : small; color: gray; } STRONG { font-size : small; color: Navy; } //--> </style></head><body><div align="center"> <table border="0" cellpadding="0" cellspacing="0" width="650" id="table2"> <tr> <td valign="top"><form action="insert.php" method="post"> <table border="0" cellpadding="0" cellspacing="0" width="650" id="table3"> <tr> <td valign="top" width="241" align="right"> <p style="margin-top: 0; margin-bottom: 3px"><font size="2">Company Name: </font> </td> <td valign="top"> <p style="margin-top: 0; margin-bottom: 3px"> <input type="text" name="Company_Name" size="33"></td> </tr> <tr> <td valign="top" width="241" align="right"> <p style="margin-top: 0; margin-bottom: 3px"><font size="2">Business Category: </font> </td> <td valign="top"> <p style="margin-top: 0; margin-bottom: 3px"> <input type="text" name="Business_Category" size="33"></td> </tr> <tr> <td valign="top" width="241" align="right"> <p style="margin-top: 0; margin-bottom: 3px"><font size="2">Directory_Category:</font></td> <td valign="top"> <p style="margin-top: 0; margin-bottom: 3px"> <input type="text" name="Directory_Catagory" size="33"></td> </tr> <tr> <td valign="top" width="241" align="right"> <p style="margin-top: 0; margin-bottom: 3px"><font size="2">Description of_Business: </font> </td> <td valign="top"> <p style="margin-top: 0; margin-bottom: 3px"> <input type="text" name="Description_of_Business" size="33"></td> </tr> <tr> <td valign="top" width="241" align="right"> <p style="margin-top: 0; margin-bottom: 3px"><font size="2">Address:</font></td> <td valign="top"> <p style="margin-top: 0; margin-bottom: 3px"> <input type="text" name="Address" size="33"></td> </tr> <tr> <td valign="top" width="241" align="right"> <p style="margin-top: 0; margin-bottom: 3px"><font size="2">City, State, Zip:</font></td> <td valign="top"> <p style="margin-top: 0; margin-bottom: 3px"> <input type="text" name="City" size="14"> <input type="text" name="State" size="4"> , <input type="text" name="Zip_Code" size="10"></td> </tr> <tr> <td valign="top" width="241" align="right"> <p style="margin-top: 0; margin-bottom: 3px"><font size="2">First Name:</font></td> <td valign="top"> <p style="margin-top: 0; margin-bottom: 3px"> <input type="text" name="First_Name" size="33"></td> </tr> <tr> <td valign="top" width="241" align="right"> <p style="margin-top: 0; margin-bottom: 3px"><font size="2">Last Name:</font></td> <td valign="top"> <p style="margin-top: 0; margin-bottom: 3px"> <input type="text" name="Last_Name" size="33"></td> </tr> <tr> <td valign="top" width="241" align="right"> <p style="margin-top: 0; margin-bottom: 3px"><font size="2">Phone:</font></td> <td valign="top"> <p style="margin-top: 0; margin-bottom: 3px"> <input type="text" name="Phone_Number" size="33"></td> </tr> <tr> <td valign="top" width="241" align="right"> <p style="margin-top: 0; margin-bottom: 3px"><font size="2">Website: </font> </td> <td valign="top"> <p style="margin-top: 0; margin-bottom: 3px"> <input type="text" name="Web_Site_Address" size="33"></td> </tr> <tr> <td valign="top" width="241" align="right"> <p style="margin-top: 0; margin-bottom: 3px"><font size="2">E-mail: </font> </td> <td valign="top"> <p style="margin-top: 0; margin-bottom: 3px"> <input type="text" name="E-mail_Address" size="33"></td> </tr> </table><p> <input type="Submit"></p></form> <p style="margin-top: 0; margin-bottom: 3px"> </td> </tr> </table> <p> </div></body></html>============================================================== Link to comment https://forums.phpfreaks.com/topic/9898-parse-error-parse-error-unexpected-in-homelakesidepublic_htmlphpinsertphp-on-line-26/ Share on other sites More sharing options...
AndyB Posted May 18, 2006 Share Posted May 18, 2006 [code]$E-mail_Address=$_POST['E-mail_Address'];[/code]That's almost certainly interpreted as $E minus mail_Address .... which is going to result in an error.Try changing it to the below (or $E_mail_Address) and be consistent anywhere that's used:[code]$Email_Address=$_POST['E-mail_Address'];[/code] Link to comment https://forums.phpfreaks.com/topic/9898-parse-error-parse-error-unexpected-in-homelakesidepublic_htmlphpinsertphp-on-line-26/#findComment-36797 Share on other sites More sharing options...
rscott7706 Posted May 19, 2006 Author Share Posted May 19, 2006 That was the problem. I have another, but that is for another day. I am frustrated and ticked at myself for not being able to code better.Thanks for your help!! Link to comment https://forums.phpfreaks.com/topic/9898-parse-error-parse-error-unexpected-in-homelakesidepublic_htmlphpinsertphp-on-line-26/#findComment-37042 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.