0

I have a search box that should look for a record that matches what was searched(transaction_num) I followed the steps here dreamweaver help but when I click the search button in the search page, it doesn't do anything. It doesn't jump to the results page.

Search page

<form action="searchRESULT.php" method="get">
  <input name="search" type="text" id="search" />
  <input name="search" type="button" id="search" value="Search" />
</form>

Result page contains the dynamic table. code generated by dreamweaver.(I use DW cs6) The filter in the recordset is set to transaction_num = URL parameter then 'search' which is the name of the search textfield in the search page.

Nothing happens when I click the search button. You can link me some tutorials or examples.

JacksonW
  • 3
  • 4

2 Answers2

0
<input type="submit" name="search" id="search" value="Search" />

In PHP file

$search = $_POST['search'];

Use SQL Query like

$sql = 'select * from tb_name where col_name like '%".$search."%' ';
jay.jivani
  • 1,560
  • 1
  • 16
  • 33
  • thanks.If what was typed in the search box doesn't match anything, how should the code go? – JacksonW Jan 10 '15 at 12:27
  • if search word doesn't match with data in database then it query return with 0 result..based on that you have to display message.. – jay.jivani Jan 10 '15 at 16:49
-1

Your Search button needs to be of the type "submit", so

<input name="search" type="submit" id="search" value="Search" />
double-beep
  • 5,031
  • 17
  • 33
  • 41
BlackCetha
  • 2,051
  • 1
  • 15
  • 15