Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Hey all.
I'm attempting to validate a grouping of phone numbers.
One the page, I have a for loop that generates a grouping of phone number forms, based on user input.
The end result are phone number variables that look like:
$phoneNumber0
$phoneNumber1
$phoneNumber2
etc..
I'm wanting to check those variable for proper phone number input (In my case, 10 digits only "1231231234").
What I've been trying to do is:Code: Select all
for($i=0;$i <= $numberTeams; $i++){
$tmp = preg_match (' /^[0-9]+$/ ', " $phoneNumbers'.$i.' " );
if ($tmp != 10){
echo "$tmp";
echo "I'm sorry, but one of the phone numbers that you entered is invalid";
echo '<br>';
echo "Please click the back button, and try again";
exit;
}
}Can anyone offer advice?
Thanks
David
Sami | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]