Problems with ereg-Command

From: Date: Thu, 06 Sep 2007 10:07:32 +0000
Subject: Problems with ereg-Command
Groups: php.db 
Request: Send a blank email to php-db+get-43966@lists.php.net to get a copy of this message
Hi, I have some problems with validating the values of the fields street, phone and fax. In the field street I want that only the european standard for writing ( <number> <name> or <name>. <number>) should be possible. By other fieldentries the user should be informed of the error and the proccessing should stop. In the fields phone and fax it should be able to write (12345) 12345 or to write 12345 / 12345 The checking of the contactperson in german Ansprechpartner is also incorrect. if (!ereg("[a-zA-Z .0-9]",$strasse)) { echo "Ung&uuml;ltige Werte in Strasse"; exit; } if (!ereg("[a-zA-Z] \.",$ansprechpartner)) { echo "Ung&uuml;ltige Werte im Ansprechpartner"; exit; } if (ereg("[0-9 ()/]",$telefon) == false) { echo "Ung&uuml;ltige Werte bei Telefon"; exit; } if (ereg("[0-9 ()/]",$fax) == false) { echo "Ung&uuml;ltige Werte bei Fax"; exit; } What is the code for the correct validating. Regards, Ruprecht Helms ----------------------------------------------------------------------- Ruprecht Helms IT-Service & Softwaredevelopement Web: http://www.rheyn.de Mail: info@rheyn.de

« previous php.db (#43966) next »