0
echo ("<a href=foldername/".$file.">".$file."</a>"."<br>");

and there

$file = readdir($handle);

in that case $file is a folder name with space.. So I have to put double quotation after href=. But it doesnt printing that double quotation. The link I am getting is only the folder name's first thing before space. So the link Generating is wrong...

Please help me..

2
Contributors
6
Replies
8
Views
7 Years
Discussion Span
Last Post by kirtan_thakkar
0

Hi, there are several methods of printing double quotes, two of them are:

1) Using single quotes:
echo '<a href="http://www.example.com">Example</a>';

2) Escaping in double quotes:
echo "<a href=\"http://www.example.com\">Example</a>";

I'd recommend sticking to single quotes since its more readable and has better micro performance because it doesn't interpolate variables as double quotes do, that is -

$x = 42;
echo "My value: $x"; // prints: My value: 42
echo 'My value: $x'; // prints: My value: $x

0

Hi, there are several methods of printing double quotes, two of them are:

1) Using single quotes:
echo '<a href="http://www.example.com">Example</a>';

2) Escaping in double quotes:
echo "<a href=\"http://www.example.com\">Example</a>";

I'd recommend sticking to single quotes since its more readable and has better micro performance because it doesn't interpolate variables as double quotes do, that is -

$x = 42;
echo "My value: $x"; // prints: My value: 42
echo 'My value: $x'; // prints: My value: $x

echo ('<a href="quotations/$file">'.$file.'</a><br>');

I have tried this but getting this link
"foldername/$file"

Help..

0

True because single quote don't interpolate variables, you'll have to use the concat operator (dot) :


echo '<a href="quotations/"' . $file . '>' . $file . '</a><br />';

0

True because single quote don't interpolate variables, you'll have to use the concat operator (dot) :


echo '<a href="quotations/"' . $file . '>' . $file . '</a><br />';

Now not getting the first name(before space)
Getting this only..
"quotations/"

1

right my mistake it should be
echo '<a href="quotations/' . $file . '">' . $file . '</a><br />';

I misplaced the second double quote.

0

right my mistake it should be
echo '<a href="quotations/' . $file . '">' . $file . '</a><br />';

I misplaced the second double quote.

Hey thanks...
It works..

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.