Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. $where = [];
  2.  
  3. if( isset( $_POST['destination_search'] )){
  4. $where[] = "`destination` LIKE '%" . mysql_real_escape_string( $_POST['destination_search'] ) . "%'";
  5. }
  6. if( isset( $_POST['cargo_search'] )){
  7. $where[] = "`cargo` LIKE '%" . mysql_real_escape_string( $_POST['cargo_search'] ) . "%'";
  8. }
  9. if( isset( $_POST['dueDate_search_last'] )){
  10. $where[] = "`delivery_date` LIKE '%" . mysql_real_escape_string( $_POST['dueDate_search_first'] ) . "%'";
  11. }
  12.  
  13. $whereStatement = "";
  14. if( count($where) > 0 )
  15. {
  16. $whereStatement = "AND" . implode( " AND ", $where );
  17. }
  18.  
  19. $query_Recordset_table = "
  20. SELECT *
  21. FROM `jobs` WHERE bid_deadline >= CURDATE() AND status != 'Offer accepted'
  22. " . $whereStatement . "
  23. ORDER BY `destination` ASC";
  24.  
  25. <form id="form_searchJobs" name="form1" method="post" action="">
  26. <input name="destination_search" type="text" class="bb-input bb-input-large" placeholder="Destination"> <br>
  27. <input type="text" name="cargo_search" placeholder="Cargo" class="bb-input bb-input-large"> <br>
  28. <input name="dueDate_search_first" type="text" id="Due_date_from" class="bb-input bb-input-small" placeholder="Due Date (from)"/> <input name="dueDate_search_last" type="text" id="Due_date_to" class="bb-input bb-input-small" placeholder="Due Date (to)"/>
  29. <input type="submit" name="search" id="search" class="button3" value="Search" />
  30. </form>
  31.  
  32. if( isset( $_POST['dueDate_search_first'], $_POST['dueDate_search_last'] )){
  33. $where[] = "`delivery_date` BETWEEN '%" . mysql_real_escape_string( $_POST['dueDate_search_first'] ) . "%' AND '%" . mysql_real_escape_string( $_POST['dueDate_search_last'] ) . "%'";
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement