Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

joining variables

Status
Not open for further replies.

thumbelina

Programmer
Jun 4, 2001
58
CA
ok here's what i'm trying to do. i have 2 text boxes that go in variables $firstname and $lastname, and for format reasons i want to then join these 2 into one variable, as in: $name = $firstname$lastname only that's not the proper syntax, and i can't find out what the proper syntax is. but i know this can be done.
 
Several ways:

$name .= $firstname;
$name .= $lastname;

$name = $firstname.$lastname;
or if you want to put a space after $firstname:
$name = $firstname." ".$lastname;

The string concatenation thing is a dot (.). You could also use the function strcat(), but the others are just easier.

Hope this helps.

-Vic vic cherubini
krs-one@cnunited.com
====
Knows: Perl, HTML, JavScript, C/C++, PHP, Flash
====
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top