Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
mr_anderson1137
Computers since 1974 Network Engineer 1991 Fiber Optics Engineer 1994 - 2002 Web Designer, Wireless Designer 2002-present
what is wrong with this code?
function formatPhoneNumber($phoneNumber) {
$phoneNumber = preg_replace('/[^0-9]/','',$phoneNumber);
if(strlen($phoneNumber) > 10) {
$countryCode = substr($phoneNumber, 0, strlen($phoneNumber)-10);
$areaCode = substr($phoneNumber, -10, 3);
$nextThree = substr($phoneNumber, -7, 3);
$lastFour = substr($phoneNumber, -4, 4);
$phoneNumber = '+'.$countryCode.' ('.$areaCode.') '.$nextThree.'-'.$lastFour;
}
else if(strlen($phoneNumber) == 10) {
$areaCode = substr($phoneNumber, 0, 3);
$nextThree = substr($phoneNumber, 3, 3);
$lastFour = substr($phoneNumber, 6, 4);
$phoneNumber = '('.$areaCode.') '.$nextThree.'-'.$lastFour;
}
else if(strlen($phoneNumber) == 7) {
$nextThree = substr($phoneNumber, 0, 3);
$lastFour = substr($phoneNumber, 3, 4);
$phoneNumber = $nextThree.'-'.$lastFour;
}
return $phoneNumber;
}
For some reason I get the number back as it was ie.12345467890 instead of (123)456-7890
Any help is appreciated
Mr A
1 AnswerProgramming & Design7 years agoCSS with Nivo Slider Question?
Easy 10 PTs for a GREAT CSS person....I have some code that I am using NIVO Slider with, however since I dont have my images in CSS they do not stretch with my table on high res. I know how to get one image into CSS and work with % there but how do I do five images that the Nivo Slider will "see"
Code is at www.henson-cove-place.com/info - use Google Chrome Dev Tools to see (Index page)
HELP me please...
1 AnswerProgramming & Design9 years agoEasy 10 pts PHP email question?
I have a web from that comes in and my First problem is that my time is off to the tune of about three hours "on Thursday 14th of June 2012 02:44:32 PM " Real time was 5:45pm.
Second issue is that when someone type an ' like in Consuela's sister, it shows up after the form comes in to my mail client with like
Consuela\'s sister in my form email, strange in my Mysql database all looks good there?
For $datetimestamp I am using $datetimestamp = date("l jS of F Y h:i:s A");
The other fields are just regular post vars
other and mail part of the script:
$email_subject = "Web Site Form Request"; //<-----Place your subject here
$email_body = nl2br("Below is the result of your feedback form. It was submitted by $name ($email_address) on $datetimestamp Here are the details from $sent_from: \n \n Email: $email_address \n \n Name: $name \n \n Address: $address \n \n City: $city \n \n State: $state \n \n Zip: $zip \n \n Phone: $phone \n \n Found us: $found \n \n Message:$message");
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .="Sent: $datetimestamp\r\n";
$headers .= "Subject: $email_subject\r\n";
$headers .= "From: ".$from." <".$email_address.">\r\n";
mail($to,$email_subject,$email_body,$headers);
Any help to solve those 2 small issue would be GREAT
Thank you all
Mr A
1 AnswerProgramming & Design9 years agoEasy 10 Pts PHP email question?
I run my web form through my PHP script.
The problem is in my headers:
when I use the following code:
$headers = "From: $name\r\n";
$headers .="Sent: $datetimestamp\r\n";
$headers .= "Subject: $email_subject\r\n";
$name comes into Outlook like this Dxxxx.Nugxxx@p3slh075.shr.phx3.secureserver.net
How do I strip out everything after the @ and get rid of the dots so it formats like so:
Charlie & Rose Mxxxx <badboy@bellsouth.net>
Easy 10 for anyone who know PHP well
1 AnswerProgramming & Design9 years agoEasy 10 Pts ...PHP Question?
here is my code:
<?php
$errors = '';
$myemail = 'xxx@xxx.com,yyy@xxx.com';
$sent_from = 'The Web Server';
if(empty($_POST['name']) ||
empty($_POST['email']))
{
$errors .= "\n Error: all fields are required";
}
$name = $_POST['name'];
$company = $_POST['company'];
$phone = $_POST['phone'];
$email_address = $_POST['email'];
$found = $_POST['through'];
$message = $_POST['comments'];
if (!preg_match(
"/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i",
$email_address))
{
$errors .= "\n Error: Invalid email address";
}
if( empty($errors))
{
$to = $myemail;
$email_subject = "Leaf Web Site Contact Form Submission: $name";
$email_body = "You have received a new message from $sent_from ".
" Here are the details:\n \n Name: $name \n \n Email: $email_address \n \n Phone: $phone \n \n Found us: $found \n \n Message: \n \n $message";
$headers = "From: $myemail\n";
$headers .= "Reply-To: $email_address";
mail($to,$email_subject,$email_body,$headers);
//redirect to the 'thank you' page
header('Location: thanks.html');
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd%22%3E
<html>
<head>
<title>Contact form handler</title>
</head>
<body>
<!-- This page is displayed only if there is some error -->
<?php
echo '<script type="text/javascript">
window.onload=function(){alert("$errors");}
</script>';
?>
</body>
</html>
I want the error window to pop-up on the same screen (if possible) and why is $errors showing as $errors literally in the error window?
Thank you all
Mr A
1 AnswerProgramming & Design9 years agoHow is History Channels Gangland Filmed?
I have noticed that these folks have EXCELLENT access to the gangs, how is that done and who do they get permission from to shoot these episodes
1 AnswerMedia & Journalism10 years agoBatch File Problem for a date?
OK I have an old client who does backups using the XP backup program..it gets backup to another drive on the LAN, what I want to do is run a batch script that will allow me to add the date to the end of the file name - i.e. regular file name = backup.bkf - I need someway of renaming it to today's date at the end of the file name i.e. backup032911.bkf and do this for every day of the week
Suggestions and thank you
Mr A
3 AnswersProgramming & Design1 decade agoIf the earth moved 25 cm on its Axis?
How many degrees is that?
3 AnswersAstronomy & Space1 decade agoProblem with Yahoo Ads?
OK I have yahoo as my start page, when I read the news stories and hit my back key every once in awhile I get this (see below). HOW do I block this from ever showing up again?
1 AnswerOther - Internet1 decade agoYahoo Videos DO NOT WORK!!!!?
OK now I am a systems engineer and an MCSE. This is NOT a browser or plugin issue. I have tested this problem on XP (sp2), Linux (ubuntu Karnac) with FireFox and on Windows 7 with I.E 7 and I,E. 8. I GET THE SAME RESULTS ALL THE TIME. Those are that the "ad trailer" plays just fine, but when it comes to the content video ALL SYSTEMS HANG. WAKE UP YAHOO YOUR #%! is sinking fast and this does NOT HELP
Any help is appreciated - just want to know for my clients that have the same issues
1 AnswerOther - Internet1 decade ago