Member Avatar for kirtan_thakkar
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..

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

Member Avatar for kirtan_thakkar

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..

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 />';

Member Avatar for kirtan_thakkar

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/"

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

I misplaced the second double quote.

Member Avatar for kirtan_thakkar

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

I misplaced the second double quote.

Hey thanks...
It works..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.