Advertisement
Guest User

Untitled

a guest
Apr 17th, 2014
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. <form action="selectDB.php" method="post">
  2. <input type="text" name="studentID" />
  3. <input type="submit" name="send" />
  4. </form>
  5.  
  6. <?php
  7. if( isset($_POST['send'])){
  8. $var = $_POST[ 'studentID' ];
  9. //now you can use the var for an query to your database
  10. //please note: this very basic, without any security of injection
  11. $res = mysql_query( 'SELECT `*` FROM `student` WHERE `idStudent` LIKE '%'.$var.'%' ' );
  12. if( mysql_num_rows($res)){
  13. $row = mysql_fetch_assoc( $res ); //get one (first) result
  14. }
  15. }
  16.  
  17. ?>
  18.  
  19. <script> location.href='editRegistration.php';</script>
  20.  
  21. <form class="form-horizontal" id="registration" method="post" action="selectDB.php" name="send">
  22. <input type="text" name="studentID" align= "right" class="textbox" value="<?php isset( $row[ '0' ] ) ? $row[ 'idStudent' ] : '' ?>" /> <span id="errorID"></span> <br/>
  23. </form>
  24.  
  25. $res = mysql_query( 'SELECT `*` FROM `student` WHERE `idStudent` LIKE '%'.$var.'%' ' );
  26.  
  27. $res = mysql_query( "SELECT * FROM `student` WHERE `idStudent` = ".$var);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement