I am getting the following error:
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/ttba/public_html/insert_attorney.php on line 32
I am fairly new to php and mysql so any help would be great.
Thanks,
JT
Here is the code:
html info insert page:
<html>
<head>
<title>Tahoe Truckee Bar Association - Add To Directory</title>
</head>
<body>
<h1>Tahoe Truckee Bar Association</h1>
<h3>Add to Directory </h3>
<form action="insert_attorney.php" method="post">
<table border=0>
<tr>
<td>First Name</td>
<td><input type=text name=first_name maxlength=15 size=30> <br></td>
</tr>
<tr>
<td>Last Name</td>
<td> <input name=last_name type=text id="last_name" size=30 maxlength=25>
<br></td>
</tr>
<tr>
<td>Firm Name</td>
<td> <input name=firm type=text id="firm" size=30 maxlength=60> <br></td>
</tr>
<tr>
<td>Address</td>
<td><input name=address type=text id="address" size=30 maxlength=40> <br></td>
</tr>
<tr>
<td>Address2</td>
<td><input name=address2 type=text id="address2" size=30 maxlength=40></td>
</tr>
<tr>
<td>City</td>
<td><input name="city" type="text" id="city" size="30" maxlength="15"></td>
</tr>
<tr>
<td>State</td>
<td><select name="state" id="state">
<option selected>CA</option>
<option>NV</option>
</select></td>
</tr>
<tr>
<td>Zip Code</td>
<td><input name="zip" type="text" id="zip" size="10" maxlength="10"></td>
</tr>
<tr>
<td>Phone</td>
<td><input name="phone" type="text" id="phone" size="30" maxlength="16"></td>
</tr>
<tr>
<td>Fax</td>
<td><input name="fax" type="text" id="fax" size="30" maxlength="16"></td>
</tr>
<tr>
<td>E-mail</td>
<td><input name="email" type="text" id="email" size="30" maxlength="40"></td>
</tr>
<tr>
<td>Practice Areas*</td>
<td><input name="practice_areas" type="checkbox" id="practice_areas" value="real_estate">Real Estate
<input name="practice_areas" type="checkbox" id="practice_areas" value="probate">Probate
<input name="practice_areas" type="checkbox" id="practice_areas" value="criminal">Criminal
<input name="practice_areas" type="checkbox" id="practice_areas" value="civil_litigation">Civil Litigation
<input name="practice_areas" type="checkbox" id="practice_areas" value="construction">Construction
<input name="practice_areas" type="checkbox" id="practice_areas" value="entertainment">Entertainment</td>
</tr>
<tr>
<td colspan=2><input name="submit" type=submit value="Add to Directory"></td>
</tr>
</table>
</form>
</body>
</html>
php file:"insert_attorney.php":
<html>
<head>
<title>Tahoe Truckee Bar Assoc. - Add Attorney Results</title>
</head>
<body>
<h1>Tahoe Truckee Bar Assoc. - Add Attorney Results</h1>
<?
if (!$first_name || !$last_name || !$firm || !$address || !$city || !$state || !$zip || !$phone || !$practice_areas)
{
echo "You have not entered all the required details.<br>"
."Please go back and try again.";
exit;
}
$first_name = addslashes($first_name);
$last_name = addslashes($last_name);
$firm = addslashes($firm);
$address = addslashes($address);
$address2 = addslashes($address2);
$city = addslashes($city);
$state = addslashes($state);
$zip = addslashes($zip);
$phone = addslashes($phone);
$fax = addslashes($fax);
$email = addslashes($email);
$practice_areas = addslashes($practice_areas);
$dbh=mysql_connect ("localhost", "ttba_ttba", "xxxxx") or die ('I cannot connect to the database.');
mysql_select_db ("ttba_directory");
$query = "insert into info values (NULL, '".$first_name."', '".$last_name."', '".$firm."', '".$address."',
'".$address2."', '".$city."', '".$state."', '".$zip."', '".$phone."', '".$fax."', '".$email"', '".$practice_areas."')";
$result = mysql_query($query);
if ($result)
echo mysql_affected_rows()." attorney inserted into database.";
?>
</body>
</html>