By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,968 Members | 1,588 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,968 IT Pros & Developers. It's quick & easy.

Problem in concatenation

100+
P: 254
Hi

I got problem while concatenating the strings here is the code

<a href=\"javascript:openit('View_Full_Image.php?id=" .$_rows['Image_Id']."&name=".$_name."')\"><img src=\"".$_rows['File_Path']."\" height=\"20\" width=\"20\">

$_name stores the full name(title) of the image.

it shows the full name on the link but when I echo this to next page it shows only the first string means not showing the string after space.

like $name="mukesh kumar"
but on next page $name only shows mukesh. so how can i do that. I also tried to use the \\ but then it is showing nothing.
Dec 28 '07 #1
Share this Question
Share on Google+
6 Replies


P: 1
Hi

I got problem while concatenating the strings here is the code

<a href=\"javascript:openit('View_Full_Image.php?id=" .$_rows['Image_Id']."&name=".$_name."')\"><img src=\"".$_rows['File_Path']."\" height=\"20\" width=\"20\">

$_name stores the full name(title) of the image.

it shows the full name on the link but when I echo this to next page it shows only the first string means not showing the string after space.

like $name="mukesh kumar"
but on next page $name only shows mukesh. so how can i do that. I also tried to use the \\ but then it is showing nothing.
Try to use urlencode() and urldecode(). It can solve th problem
Dec 28 '07 #2

100+
P: 254
Try to use urlencode() and urldecode(). It can solve th problem
In this code where I need to write urlencode and where to write urldecode.
Dec 28 '07 #3

Markus
Expert 5K+
P: 6,050
it took me forever to work out what you were talking about :P

Do urlencode() on your $_name

[php]
&name=".urlencode($_name)."
[/php]

Hope that helps :)
Dec 28 '07 #4

100+
P: 254
it took me forever to work out what you were talking about :P

Do urlencode() on your $_name

[php]
&name=".urlencode($_name)."
[/php]

Hope that helps :)
No this also did not worked on hyperlink it shows the string like mukesh+kumar but when I retrieve this value on other page it shows only mukesh. on other page I used urldecode as well.
Dec 29 '07 #5

Markus
Expert 5K+
P: 6,050
Don't use url decode..

just use $_GET - it'll print out the string and replace + with a space; like the original.

:)
Dec 29 '07 #6

P: 6
So we create a variable to contain a space character as well:

$Space = " ";

You should note that this quite different from having an empty string. An empty string contains nothing at all, while a string with a space contains a character, albeit an invisible one. Spaces of course can be concatenated just like any other text:

$Car = $CarType . $Space . $EngineSize;

This would produce the desired, nicely spaced-out text Cadillac 2.6. Of course, there's no reason why you can't concatenate variables with actual text phrases as well:

$Car = "Buick" . $Space . "2.0";

Here we added text to a variable to more text, which produces the response Buick 2.0. There would also have been nothing wrong with the following line either:

$Car = "Buick" . " " . "2.0";
Dec 30 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.