php - How to make links in Search bar go to a different page? -


I currently have a somewhat active search bar and it works the way I want, I Was thinking that it is possible to add links to different items? Anything else in redirect is still in 'session.php'. I am able to illustrate if someone searches for 'Home', then I am able to display the results and then the user can click on 'Home.php' ? Thanks!

Search.php code:

  & lt ;? Php // --- Authentication code starts here --- session_start (); // Check if login session is true (!! ($ _ session ['ass_user']) (header ("location: index.php");} $ Username = $ _SESSION ['sess_user']; // --- The certification code ends here ---? & Gt; link rel = "stylesheet" type = "text / css" href = "../css / style1.css" & gt; & lt; php mysql_connect ("Localhost", "root", "") or die ("error connecting to database:". Mysql_error ()); mysql_select_db ("aha") or die (mysql_error ());? & Gt; & lt ; Html> & lt; / html>  

logout

   gt; title & gt; search Results & lt; / title & gt; Meta http-equiv = "content-type" content = "text / html; charset = UTA F-8 "/> 
link rel =" stylesheet "type =" text / css "href =" style.css "/> & lt; / head> gt; body & gt; $ Str_en = $ _GET ['query']; $ min_length = 3; if (strlen ($ query) & gt; = $ min_length) {// if query length is more or less minimum length then $ query = Htmlspecialchars ($ query); // The change in the character described in html in their equation, for example: & lt; From & amp; Gt; $ Query = mysql_real_escape_string ($ query); // ensures that no SQL injection does not use $ raw_results = mysql_query ("select 'from the article where (`%' like '%'. $ '.' '%') Or (`text ' Like '%.' $. "% ')" Or die (mysql_error ()); // * means that it selects all the fields, you can also write: `id`,` title` , `Text` // is the name of our table, // '% $ query%' which means what I see,% means something, for example if $ query is // it is" Hello "," Hello man "," Gogollo "from May If you want the exact match 'title' = '$ query' // or if you want to match only the full word "gogohello" '% $ query%' out ... or ... ' $ Query% '... or ...'% query $ 'is used if (mysql_num_rows ($ raw_results) & gt; {// if one or more rows are returned ($ Results = mysql_fetch_array ($ raw_results)) {// $ results = mysql_fetch_array ($ raw_results) puts data in the array from the database, while it is valid loop echo "& lt; A href = '.. / pages / session.php' & gt; & Lt; H3 & gt; {$ Result ['title']} & lt; / H3 & gt; & Lt; / A & gt; & Lt; P & gt; {$ Result ['text']} & lt; / P & gt; "}}} And {// if any unmatched rows resonate following (" << "no & Gt; ");}} and {// if the query length is less than the minimum echo (" & lt; / br> the minimum length & lt ; / Br & gt; "$ min_length);}? & Gt; & lt; / body & gt; & lt; br & gt; & lt; a class =" btn btn-search " Type = "button" href = "index.php" & gt; rediscover & lt; / a & gt; & lt; / br & gt; & lt; / br & gt; DB for articles:

Thank you!

For each record, the name of the page must be stored, and then it must be received from your query.

With this in mind, you can put it on your SQL table in a column called "page_name" According to the user's query, point this line to the correct page:

  echo " 

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -