View Full Version : Merging two text strings
stonner
08-14-2008, 08:21 PM
Hi
I want to merge two text strings. But the following code doesn't work.
$text1 = urlencode($_POST[text]);
$text2 = "Kostenlos von www.SchuelerCommunity.com";
$text = $text1 & $text2;
Do you know why?
Thank you for your help!
TigerWare
08-14-2008, 08:28 PM
String concatenation in PHP is done using the decimal point, eg:
$foobar = $foo . $bar;
You might want to bookmark this (http://www.php.net/manual/en/) site for future reference. :up:
stonner
08-14-2008, 08:43 PM
Thank you very much!
The following code worked fine:
$text1 = urlencode($_POST[text]);
$text2 = "www.SchuelerCommunity.com";
$text = $text1 . $text2;
But when I tried the following, it doesnt work:
$text1 = urlencode($_POST[text]);
$text2 = "Kostenlos aus www.SchuelerCommunity.com";
$text = $text1 . $text2;
Why this? I think it's because of the space....
Any help?
Thank you
Opserty
08-14-2008, 11:03 PM
Can you be a little more descriptive then "it doesn't work". Do you get PHP errors? What is the output? e.t.c.
Try:
$text1 = urlencode($_POST['text']);
$text2 = 'Kostenlos aus www.SchuelerCommunity.com';
$text = $text1 . $text2;
I see nothing wrong with this code, so it should work.
TigerWare
08-15-2008, 09:57 PM
I see nothing wrong with this code, so it should work.
Agreed here too. I put the code into a plugin and it was perfectly ok. :confused:
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.