Advertisement
Guest User

Untitled

a guest
Aug 29th, 2015
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. <?php
  2. $a = $_POST['findSchool'];
  3.  
  4. //1. Enter database credentials
  5. $servername = "****";
  6. $username = "****";
  7. $password = "****";
  8. $dbname = "****";
  9. $flag = 0;
  10.  
  11. // 2. Create connection
  12. $conn = new mysqli($servername, $username, $password, $dbname);
  13. echo '<form id="myNewForm" name="myNewForm" class="form" method="post" action="">';
  14. echo '<table class="table table-bordered">';
  15. echo '<tr scope="col" >
  16. <th align="center">SchoolName</th>
  17. <th align="center">Details</th>
  18. </tr>';
  19. $sql = "SELECT schName FROM schoolinformation WHERE schName LIKE '%$a%'";
  20. echo $sql;
  21. $i = 0;
  22. $result = mysqli_query($conn, $sql);
  23. while($rowval = mysqli_fetch_array($result))
  24. {
  25. $schName= $rowval['schName'];
  26. echo '<tr scope="col"><td align="center">'.$rowval['schName'].'</td>
  27. <td align="center"><input type="submit" id="shwData" name="shwData" class="btn" value="Show"/></td>';
  28. }
  29. echo '</table>';
  30. echo '</form>';
  31.  
  32. if($schName == '')
  33. {
  34. echo "Entry not found";
  35. $flag = 1;
  36. }
  37. else
  38. {
  39. //echo $schName;
  40. $flag = 0;
  41. }
  42. ?>
  43.  
  44. <?php
  45. if (isset($_POST['shwData']))
  46. {
  47. echo "this is it";
  48. }
  49. ?>
  50.  
  51. $a = $_POST['findSchool'];
  52.  
  53. session_start();
  54. if(isset($_POST['findSchool'])){
  55. $_SESSION['a'] = $_POST['findSchool'];
  56. }
  57. $a = $_SESSION['a'];
  58.  
  59. $a = isset($_POST['findSchool']) ? 'Found '.$_POST['findSchool'] : '';
  60. echo $a;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement