icon Get the most out of Surmunity, read our tips here! Need an interesting blog to read? You've got to read the Surpass Blog! | Welcome! Please register to access all of our features.

» Surpass Web Hosting Forums » Discussions » PHP, MySQL » Combining Text Fields

PHP, MySQL General PHP questions. Or go to our PHPsuexec Forum >>

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread
Old December 23rd, 2004, 3:44 PM   #1 (permalink)
Registered User
Fresh Surpasser
 
Joined in Oct 2004
3 posts
Gave thanks: 0
Thanked 0 times
Combining Text Fields

I am creating a mail form in PHP. In the message body, I would like to combine some fields that are separate on the submission form. There may already be a thread relating to this, but I could not think of what search criteria to use to find it. It is pretty simple to do in VB and in SQL, but I am not sure how to do it in PHP. I have listed an example of what I am trying to do below.

Example:
Form
First Name: John
Last Name: Doe

E-mail
Full Name: John Doe

In VB or SQL, I would simply use an ampersand (&) to combine the fields. Is there something similar that can be done in PHP.

Thanks in advance.
Jason

Last edited by nvbanker; December 23rd, 2004 at 3:46 PM..
nvbanker is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old December 23rd, 2004, 4:08 PM   #2 (permalink)
lad
Registered User
Seasoned Poster
 
Joined in Oct 2004
61 posts
Gave thanks: 1
Thanked 0 times
string concatenation

The string concatenation operator in PHP is ".", the dot. For your example:

PHP Code:
$first "John";
$last "Smith";

// echo full name: "John Smith"
$fullname $first . $ last
__________________
pass17
dreamhead.com
lad is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old December 23rd, 2004, 4:59 PM   #3 (permalink)
Registered User
Fresh Surpasser
 
Joined in Oct 2004
3 posts
Gave thanks: 0
Thanked 0 times
Thanks for the quick reply and for the proper term. It worked like a charm.

Jason
nvbanker is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old December 23rd, 2004, 5:54 PM   #4 (permalink)
sam
Surpass Fan
Super #1
 
sam's Avatar
 
Joined in Dec 2003
Lives in NJ
5,057 posts
Gave thanks: 0
Thanked 4 times
two thumbs up. very helpful.
sam is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On