Hello i made a search box and i want to make a link what will pass the search word that the user put in the search box.
e.g. http://localhost/myproject/allSearches.php?searchword=aa

aa is what the user put for search. Now i want to get that, sort it and return the data.

I do this

j+= '<div>Search for all <a href="'+apiBaseUrl+'allSearches.php?search='+searchword+'">'+searchword+'</a></div';

and in allSearches.php returns nothing when in should return aa

<?php
$searchword=$_GET['search'];
?> <div><?php echo 
$searchword;
?> </div> 

Recommended Answers

All 4 Replies

Hi, do:

print_r($_GET);

inside allSearches.php and see what you get.

//Edit

Oh, wait, I'm not sure I have understood your request. You want to perform an AJAX request with the GET method?

No i just want to fetch the searchword=aa so that i can return data using a php function. I use jquery for the link j+= '<div>Search for all <a href="'+apiBaseUrl+'allSearches.php?searchword='+searchword+'">

When i do print_r it returns Array ( [searchword] => aa )

when i do echo ($_GET); returns Array

Maybe is because the link is on $.each(data, function(i,data)??

OK now returns ok <?php $searchword= ($_GET['searchword']);?>

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.