Jump to content

Parse error: parse error, unexpected '=' in /home/lakeside/public_html/php/insert.php on line 26


Recommended Posts

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. So
if 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>
==============================================================

[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]
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.