How I can put limitation when someones submits a form so that
the e-mail adress format looks like this letters@letters.2to3letters?
Does anyone know?

Firstly, I should point out that not all email addresses are of the form something@letters.2-3letters.

For example: john@vuw.ac.nz, bob@blah.travel, fred@sprint.mobi, and so on.

I recommend you use this logic to determine the validity of an email address:

if (!preg_match('/^[_A-z0-9-]+((\.|\+)[_A-z0-9-]+)*@[A-z0-9-]+(\.[A-z0-9-]+)*(\.[A-z]{2,})$/',$email)) {
  echo "Invalid address";
  }

Obviously you'll need to replace the contents of the IF loop to perform what it is you want (e.g. a redirect, displaying an error message, etc).

However - if you want something@letters(WithNoDots).2-3letters then this should do it:

if (!preg_match('/^[_A-z0-9-]+((\.|\+)[_A-z0-9-]+)*@[A-z0-9-]+(\.[A-z]{2,3})$/',$email)) {
  echo "invalid address"
  }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.