No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
I've got this script to validate phone numbers. I want to allow numbers 0-9 and the characters -,(,) and + the following seems to only work if the input is all numbers and spaces. Suggestions? [code] if(!ereg("^[0-9\-\(\)\ \+]+$", $phoneNumber)||empty($phoneNumber)){ print'Please enter a valid phone number' ; $error++; } [/code] |
|
I'm having a trouble getting my php script to validate user input what am I doing wrong here? This just displays the error message all the time. for example: [code] if(!preg_match("/[^a-zA-Z0-9\.\-\Ä\ä\Ö\ö\Ü\ü\ ]+$/",$name)||empty($name)) { print '<td colspan="2" class="ErrorText"><div align="right">Please enter a valid name without special characters i.e. *,/,< etc. </div></td>'; $error++; … |