Hi,
I have a simple form which posts user data to a confirmation page and then passes them to email via hidden fields after the user proofs what they entered.
I have no problems with the confirmation page, but if any fields contain an apostophe, everything after the apostrophe (single quote) is missing.
I have tried every combination of stripslashes, addslashes, htmlentities, etc., but every time someone enters an apostrophe, everything after disappears.
Can anyone offer any suggestions?
Thank you in advance!!!
Here is the form in question
http://www.albright.edu/admin/bcardform.php
code follows
<?php
//this is the confirmation screen
if ($name == "" or $title=="" or $phone =="" or $fax =="" or $email =="" or $acctNumber =="" or $dept == "") {
echo "<p align='center'><b><font face='arial,helvetica,sans-serif' size='2'>Some fields which are required to submit the form were left blank.</font></b></p>";
echo "<p align='center'><font face='arial,helvetica,sans-serif' size='2'>Please use your browser's BACK button to return to the form and fill out the fields.</font></p>";
exit;
}
else
{
$specialRequest = stripslashes($specialRequest);
echo "<html><head><title>Business card request results</title>
<style type='text/css'>
body { background-color: #ffffff;}
a:link { text-decoration: none; color: #cc0000}
:visited { color: #cc0000}
a:hover { text-decoration: underline}
.smalltext { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 9.5px}
.bolditalhead { font-family: Arial, Helvetica, sans-serif; font-size: 14px; font-style: italic; font-weight: bold}
.mediumlink { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #b30000; font-weight: bold}
.boldmedtext { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold}
.medtext { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px}
.arialink {font-family: Arial, Helvetica, sans-serif; font-size: 13px; font-weight: bold}
.arialmed { font-family: Arial, Helvetica, sans-serif; font-size: 13px; line-height: 15px}
.arialmedbold { font-family: Arial, Helvetica, sans-serif; font-size: 13px; font-weight: bold}
.headline { font-family: Arial, Helvetica, sans-serif; font-size: 1.6em; font-weight: bold}
.honorstext { font-family: 'Times New Roman', Times, serif; font-size: 17px; line-height: 28px}
</style>
</head>
<table with='100%' cellspacing='0' cellpadding='4' border='0'>
<tr><td align='center' colspan='2' class='medtext' valign='top'>Below is the information you submitted. <b>PLEASE double check everything before you hit the submit button.</b></td></tr>
<tr><td align='center' colspan='2' class='medtext' valign='top'>Thanks for using the online business card request!</td></tr>
<tr><td align='center' colspan='2'><hR></td></tr>
<tr><td align='right' class='boldmedtext' width='50%' valign='top'>Name:</td><td align='left' width='50%' class='medtext' valign='top'>$name</td></tr>
<tr><td align='right' class='boldmedtext' valign='top'>Title:</td><td align='left' class='medtext' valign='top'>$title</td></tr>
<tr><td align='right' class='boldmedtext' valign='top'>Phone:</td><td align='left' class='medtext' valign='top'>$phone</td></tr>
<tr><td align='right' class='boldmedtext' valign='top'>Fax:</td><td align='left' class='medtext' valign='top'>$fax</td></tr>
<tr><td align='right' class='boldmedtext' valign='top'>Email:</td><td align='left' class='medtext' valign='top'>$email</td></tr>
<tr><td align='right' class='boldmedtext' valign='top'>Include home or cell phone:</td><td align='left' class='medtext' valign='top'>$includeHomePhone
<p>Home Phone: $homephone<bR>Cell Phone: $cellphone</p></td></tr>
<tr><td align='right' class='boldmedtext' valign='top'>Non-standard mailing address:</td><td align='left' class='medtext' valign='top'>$nonStandardAddress
<p align='left'>$nsAddress</p></td></tr>
<tr><td align='right' class='boldmedtext' valign='top'>Special request:</td><td align='left' class='medtext' valign='top'>$specialRequest</td></tr>
<tr><td align='right' class='boldmedtext' valign='top'>Account Number:</td><td align='left' class='medtext' valign='top'>$acctNumber</td></tr>
<tr><td align='right' class='boldmedtext' valign='top'>Department:</td><td align='left' class='medtext' valign='top'>$dept</td></tr>
<tr><td align='right' class='boldmedtext' valign='top'>Quantity:</td><td align='left' class='medtext' valign='top'>$quantity</td></tr>
<tr><td align='center' colspan='2'><form method='POST' action='bcardtomark.php'>
<input type='hidden' name='name' value='$name'>
<input type='hidden' name='title' value='$title'>
<input type='hidden' name='phone' value='$phone'>
<input type='hidden' name='fax' value='$fax'>
<input type='hidden' name='email' value='$email'>
<input type='hidden' name='includeHomePhone' value='$includeHomePhone'>
<input type='hidden' name='homephone' value='$homephone'>
<input type='hidden' name='cellphone' value='$cellphone'>
<input type='hidden' name='nonStandardAddress' value='$nonStandardAddress'>
<input type='hidden' name='nsaddress' value='$nsaddress'>
<input type='hidden' name='specialRequest' value='$specialRequest'>
<input type='hidden' name='acctNumber' value='$acctNumber'>
<input type='hidden' name='dept' value='$dept'>
<input type='hidden' name='quantity' value='$quantity'>
<input type='submit' name='Submit' value='Submit'></form></td></tr>
</table>";
}
?>
<?php
{
//this is the email script
//$specialRequest = strip_tags($specialRequest);
mail("dmarkowski@alb.edu", "Business Card Request", "Name: $name\n Title: $title\n Phone: $phone\n Fax: $fax\n Email: $email\n Include Home or Cell: $includeHomePhone\n Home Phone: $homephone\n Cell Phone: $cellphone\n Non-standard Address: $nonStandardAddress\n $nsAddress\n Special Request: $specialRequest\n Account Number: $acctNumber\n Department: $dept\n Quantity: $quantity\n", "From: $email\n");
echo "<p align=center><font face='arial,sans-serif'><b>Thanks for submitting your request online!</b></p>";
echo "<p align=center><font face='arial,sans-serif' size=2>Your request will be processed as quickly as possible.</p>";
echo "<p align=center><b><font face='arial,sans-serif' size=2><a href='http://www.albright.edu/'>Back to Albright College</a></font><b></p>";
echo "<p> </p>";
echo "<p><hr size=4></p>";
}
?>