Combining $_POST Data

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tail
Forum Commoner
Posts: 66
Joined: Sat Oct 01, 2005 4:42 pm
Location: NJ

Combining $_POST Data

Post 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.
jmut
Forum Regular
Posts: 945
Joined: Tue Jul 05, 2005 3:54 am
Location: Sofia, Bulgaria
Contact:

Post by jmut »

http://bg.php.net/string
look for concatenate
tail
Forum Commoner
Posts: 66
Joined: Sat Oct 01, 2005 4:42 pm
Location: NJ

Post by tail »

Thanks.
Post Reply