Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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