Mahmud Adam
Mahmud Adam

Reputation: 3579

Linking to Google Search in href

I am dynamically creating a table, and I'd like to display the title of the books to be links to a Google search of the title. I have looked at many solutions here, but all suggest something like this:

"<td><a href='http://google.com/q={$title}'>'$title'</a></td>";

echo "<TR>";
echo "<TD><a href='http://google.com/q={$title}'>$title</a></TD>";
echo "</TR>";

But I cannot get this to work since // keeps getting recognized as a comment. Is there a better way to do this?

Upvotes: 0

Views: 136

Answers (1)

MRustamzade
MRustamzade

Reputation: 1455

try this one:

echo "<TR>";
echo "<TD><a href='http://google.com/?gws_rd=cr,ssl#q={$title}'>$title</a></TD>";
echo "</TR>";

it is not perfect way to search, use google search script for best result. https://developers.google.com/custom-search/docs/tutorial/implementingsearchbox

Upvotes: 1

Related Questions