Page 1 of 1

Combining $_POST Data

Posted: Sat Feb 24, 2007 1:36 am
by tail
I have 3 input fields on a page for a phone number, one for area code, one for the first three digits, and one for the last for. I'm trying to combine these into a variable that would hold this: (area) first 3-last 4

I'm using this but it isn't functioning the way I'd hope it would:

Code: Select all

$phone='(' + $_POST['areacode'] + ')' + ' ' + $_POST['phone1'] + '-' + $_POST['phone2'];
Understandably, it adds up all of the values, but I was wonder if there was a way to make it look like this:

(123) 456-7890

Thanks in advance.

Posted: Sat Feb 24, 2007 2:01 am
by jmut
http://bg.php.net/string
look for concatenate

Posted: Sat Feb 24, 2007 2:33 am
by tail
Thanks.