Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form action="selectDB.php" method="post">
- <input type="text" name="studentID" />
- <input type="submit" name="send" />
- </form>
- <?php
- if( isset($_POST['send'])){
- $var = $_POST[ 'studentID' ];
- //now you can use the var for an query to your database
- //please note: this very basic, without any security of injection
- $res = mysql_query( 'SELECT `*` FROM `student` WHERE `idStudent` LIKE '%'.$var.'%' ' );
- if( mysql_num_rows($res)){
- $row = mysql_fetch_assoc( $res ); //get one (first) result
- }
- }
- ?>
- <script> location.href='editRegistration.php';</script>
- <form class="form-horizontal" id="registration" method="post" action="selectDB.php" name="send">
- <input type="text" name="studentID" align= "right" class="textbox" value="<?php isset( $row[ '0' ] ) ? $row[ 'idStudent' ] : '' ?>" /> <span id="errorID"></span> <br/>
- </form>
- $res = mysql_query( 'SELECT `*` FROM `student` WHERE `idStudent` LIKE '%'.$var.'%' ' );
- $res = mysql_query( "SELECT * FROM `student` WHERE `idStudent` = ".$var);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement