This is a pre-historic code of search.
How can I improve this old code here?Code:<?php include("connection.php"); // YOUR CONNECTION DETAILS if(isset($_POST['btnSubmit'])) { $x = $_REQUEST['searchtxt']; $r= "SELECT * FROM `incan` WHERE `TITLE` LIKE '%$x%' OR `DESCRIPTION` LIKE '%$x%' UNION SELECT * FROM `incan2` WHERE `TITLE` LIKE '%$x%' OR `DESCRIPTION` LIKE '%$x%' "; $d= mysql_query($r); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <form action="main_search.php" method="post"> <input type="text" name="searchtxt" /><input type="submit" name="btnSubmit" value="SEARCH" /> <?php if(isset($d)) { ?> <table> <?php while($arr_Results = mysql_fetch_array($d)) { ?> <tr> <td><?php echo html_entity_decode($arr_Results['TITLE']) ; ?></td> <td><?php echo html_entity_decode($arr_Results['DESCRIPTION']); ?></td> </tr> <?php } } ?> </table> </form> </body> </html>
How can I put a variable in the url using post? www.yoursite.com?q=querystring+from+textbox.
I am also preparing that the www.yoursite.com?q=querystring+from+textbox. will turn into
http://www.yoursite.com/search/query...g-from-textbox
Hope you can enlighten me on this.
I am testing locally.
I am running PHP 5 on my machine.
Thank you very much!



Reply With Quote


Bookmarks