Olive Branch MS Chamber of Commerce (circa Oct 1999)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

64 lines
2.7 KiB

  1. <?php // contact search form
  2. // provide access to external db config variables
  3. require("cfg.php3");
  4. // connect to the db and build the category list
  5. $link = connect($host, $dbname);
  6. if($link) {
  7. $query = "select distinct category from contact";
  8. $result = query($link, $query);
  9. $count = numrows($result);
  10. // if we return a list of categories,
  11. // build our form for the data query
  12. if($count) {
  13. print("<br>\n<br>\n<form method=\"post\" action=\"page.php3?");
  14. print("content=mem_result\">\n<table border=0>\n");
  15. print("<tr>\n <td class=label>Category:</td>\n");
  16. print(" <td class=data>\n <select name=\"category\">\n");
  17. print(" <option value=\"\">--- All Categories ---\n");
  18. for($row = 0; $row < $count; $row++) {
  19. $data = fetch_object($result, $row);
  20. print(" <option value=\"$data->category\">");
  21. print("$data->category\n");
  22. }
  23. free_result($result);
  24. print(" </select></td></tr>\n");
  25. print(" <input type=\"hidden\" name=\"same\" value=\"$content\">\n");
  26. print("<tr>\n <td class=label>Company Name:</td>\n <td class=data>");
  27. print("<input type=\"text\" name=\"name\" size=28 maxlength=28></td>");
  28. print("</tr>\n<tr>\n");
  29. // cover for missing items
  30. // print("<input type=\"hidden\" name=\"nameoption\" value=\"contain\">\n");
  31. // print("<input type=\"hidden\" name=\"contactoption\" value=\"contain\">\n");
  32. print("<td></td>\n");
  33. print("<td class=center>\n <input type=");
  34. print("\"radio\" name=\"nameoption\" value=\"start\">starts with\n ");
  35. print("<input type=\"radio\" checked name=\"nameoption\" value=");
  36. print("\"contain\">contains\n <input type=\"radio\" name=\"nameoption\"");
  37. print(" value=\"end\">ends with\n </td></tr>\n<tr>\n");
  38. print(" <td class=label>");
  39. print("Contact Name:</td><td class=data>\n <input type=\"text\" ");
  40. print("name=\"contact\" size=28 maxlength=28></td></tr>\n");
  41. print("<tr>\n <td>");
  42. print("</td>\n <td class=center>\n");
  43. print("<input type=\"radio\" name=\"");
  44. print("contactoption\" value=\"start\">starts with\n <input type=");
  45. print("\"radio\" checked name=\"contactoption\" value=\"contain\">");
  46. print("contains\n <input type=\"radio\" name=\"contactoption\" value=");
  47. print("\"end\">ends with\n </td></tr>\n<tr>\n");
  48. print(" <td colspan=2> &nbsp ");
  49. print("</td></tr>\n<tr>\n <td colspan=2 align=center><input type=");
  50. print("\"submit\"></td></tr>\n</table>");
  51. } else {
  52. print("<div class=center>\n<h2>Empty Result:</h2>\n");
  53. print("<h2>The following query returned an empty ");
  54. print("result:</h2><p>$query");
  55. }
  56. } else {
  57. print("<div class=center>\n<h2>Database Error</h2>\n");
  58. print("<h2>Failed to connect to database: $dbname</h2>\n");
  59. }
  60. ?>