GroundZeroStudio Posted March 11, 2007 Share Posted March 11, 2007 if (ereg("(Name)", $field)) //CHECKS USERNAME { if (!ereg("^[A-Za-z' -]{1,50}$",$value)) { unset($_GET['do']); $message_new = "$field is not a valid name. Please try again."; include("login_form.html"); exit(); } } $$field = strip_tags(trim($value)); //STRIPS CODE TAGS AND SPACES ... $pattern = '([[:digit:]]|[~`!@#$%^&*()_=+{}|\:;"/?,]|[|]|-)+'; if (ereg($pattern,$firstname)) //This code checks the first name { //This is the code that is executed if the first name is invalid unset($_GET['do']); $message_new = "$firstname is not a valid format "; include("login_form.html"); exit(); } As you might realize I left out a great deal of my code for security reasons. Anyway, when i enter O'Hearn as a name in the field and submit it, it returns with the error O\'Hearn is not a valid format Everytime I click submit, one more \ is added. Any idea what is wrong? Link to comment https://forums.phpfreaks.com/topic/42257-forms-keep-adding-slashes/ Share on other sites More sharing options...
Orio Posted March 11, 2007 Share Posted March 11, 2007 That's because you have magic_quotes enabled. Use stripslashes() to get rid of the slashes. Orio. Link to comment https://forums.phpfreaks.com/topic/42257-forms-keep-adding-slashes/#findComment-204996 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.