Jump to content

Forms keep adding slashes


GroundZeroStudio

Recommended Posts

 		
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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.