English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Hi,

Im doing some php and mysql and am having abit of trouble, I got a script from the internet and this bit validates it:

// Check for a email.
if (eregi ("^[[:alnum:]_]{0,25}$", stripslashes(trim($_POST['email'])))) {
$em = escape_data($_POST['email']);
} else {
$em = FALSE;
echo '

Please enter valid email!

';
}

Just wondering what each bit meant so I could decifer it and make it work.

Cheers

2007-03-16 11:06:22 · 3 answers · asked by jeff lemon 1 in Computers & Internet Programming & Design

3 answers

Don't know much about php SQL but could the error be in line 2 at the end where you have POST['emai...{

Should this read POST['email'] as in line 3?

The FALSE statement prints in red "Please enter valid email" if the address is invalid after the check has been made in line 2

2007-03-16 11:17:52 · answer #1 · answered by Charlie Babbage 5 · 0 0

:D It just validates a POSTed email address and no more.

The argument for the "if" statement checks if the POST variable called "email" is a valid email address. For this part you'll need some knowledge on regular expressions

If so, then the POST variable gets escaped and is assigned to the "em" variable.

Other case a HTML meesage will be displayed.

2007-03-16 11:25:57 · answer #2 · answered by Carlos V 2 · 0 0

the 1st 2 responses could no longer be extra incorrect. You do *no longer* might desire to nicely known sq. or connect with a database to apply Hypertext Preprocessor. Hypertext Preprocessor permits you to create dynamic web pages in which you (the webmaster) can administration content cloth and consumer enter extra effectual than you are able to with undemanding vanilla HTML. indexed under are some issues you're able to do in Hypertext Preprocessor with out mandatory to nicely known sq.: one million) Create comprise documents and templates 2) Have a consumer positioned up a sort and additionally you will then prefer to do something you choose with the information 3) Use the GD extension to create pics 4) Create graphs and pie charts 5) Do mathematical calculations 6) Inclue if & case statements on your html 7) Create extra effectual blunders coping with 8) plenty plenty extra 9) and confident even connect with a database utilising sq. stable good fortune :-)

2016-10-02 06:02:08 · answer #3 · answered by zaheer 4 · 0 0

fedest.com, questions and answers