Hi All,
I am using the str_replace to remove special characters from a phone number field (from a php form) and in the resulting email, I get the phone number entered, minus the junk characters.
But in the database field (which is an int(11) characters with no special setting), I get the same number (2147483647) ??
I enter in "800-555-1212abcdef&!" into the phone number field to test it. Note that no matter what number I enter into that field, I get the same number (2147483647) each time.
Here is the code for that field:
//Get the field data
$SchoolPhone = addslashes($_POST['SchoolPhone']);
// Remove extra characters from the phone number
$pnumber = array("!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "[", "]", "{", "}", ";", ":", "/", "-", "_", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z");
$JustPhoneNumbers = str_replace($pnumber, "", $SchoolPhone);
// email the results (just the line for that field, the email is working OK
. "SchoolPhone: $JustPhoneNumbers\n"
//now the database insert command (I gave the entire string to check for errors
$sql ="insert into Feedback";
$sql .="(Surname, FirstName, LastName, Title, Elementary, Grade7, Grade8, Grade9, Grade10, Grade11, Grade12, PostSecondary, School, SchoolAddress, City, State, Zip, SchoolEmailAddress, EmailAddress, SchoolPhone, Greed, Scaring, Freeloaders, AmericaOne, Washington, SeeITCM, HowManyYrs, SubjectAreas, ColleaguesUse, HowMany, ReferThem, Comments, UseComments, AddBrochYes, AddBrochQty, Date, Time)";
$sql .="values('$Surname', '$FirstName', '$LastName', '$Title', '$Elementary', '$Grade7', '$Grade8', '$Grade9', '$Grade10', '$Grade11', '$Grade12', '$PostSecondary', '$School', '$SchoolAddress', '$City', '$State', '$Zip', '$SchoolEmailAddress', '$EmailAddress', '$JustPhoneNumbers', '$Greed', '$Scaring', '$Freeloaders', '$AmericaOne', '$Washington', '$SeeITCM', '$HowManyYrs', '$SubjectAreas', '$ColleaguesUse', '$HowMany', '$ReferThem', '$Comments', '$UseComments', '$AddBrochYes', '$AddBrochQty', '$Date', '$Time')";
if(!mysql_query($sql)){
echo mysql_errno().'<br>You need some MySQL HELP with this page.<br><br><br>'.mysql_error().'<br><br>';
}
I know I am missing something basic, I just don't know what.
Thanks in advance,
Don