Praetorian Posted May 8, 2008 Share Posted May 8, 2008 I'm using this form as a basic email form. After doing some random testing I found that, when there's an error with the form and it reloads the page with the previously entered content + errors, the content is escaped. Any \ or " or ' are escaped. Is there any way to turn this off? I hesitate to use stripslashes in case someone wanted slashes in their message so. Is there a way to turn the escaping off?Here's the script.FORM <form method="post" action="mail.php" name="mail" onsubmit="return ValidateRequiredFields();"> <div class="contact"><p>* : Required Fields</p> <p><b>* Name : </b> <input type="text" name="Name" size="20" value='<?= $Name ?>' /></p> <p><b>* Email : </b> <input type="text" name="Email" size="20" value='<?= $Email ?>' /></p> <p><textarea name="Message" rows="15" cols="52"><?= $Message ?></textarea></p></div> <h1><input type="submit" value="Send" class="button" name="submit" /></h1></form> SCRIPT <?php $Name = $_REQUEST['Name']; $Email = $_REQUEST['Email']; $Message = $_REQUEST['Message']; $submit = $_REQUEST['submit']; $errors = Array();if(isset($submit)){ if ($Name == '' || !eregi('[a-z]', $Name)) { $errors[] = '<h3>Please enter a valid name.</h3>'; } if ($Email == '' || !eregi("^[a-z0-9]+([!#$%*/?|^{}`~&'+-=_][a-z0-9])*@[a-z0-9]+([!#$%*/?|^{}`~&'+-=_][a-z0-9])*.[a-z]{2,3}$", $Email)) { $errors[] = '<h3>Please Enter a Valid Email Address.</h3>'; } if ($Message == '') { $errors[] = '<h3>Please enter a message.</h3>'; } if (empty($errors) && isset($Email)) { mail( "author@tsrealms.com",$Name,$Message,"From: $Email" ); echo '<h1>Thank you for your message! One of the admins should be getting back to you via email within 24 hours.</h1>'; } else { foreach ($errors AS $e) echo $e; include 'mailform.txt'; }}else { include 'mailform.txt';}?> Link to comment Share on other sites More sharing options...
zppblood Posted May 8, 2008 Share Posted May 8, 2008 http://us.php.net/manual/en/info.configura...agic-quotes-gpc Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.