Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function selected($value, $post) {
- if ($value == $post) {
- return "selected";
- }
- }
- $class= '';
- if (!EMPTY($_POST['class'])) {
- $class = $_POST['class'];
- }
- ?>
- <form action="" method="POST">
- <select name="class">
- <option value="">Please Select</option>
- <option value="nursery1" <?php echo selected($nursery1, $class); ?> >Nursery One</option>
- <option value="nursery2" <?php echo selected($nursery2, $class); ?> >Nursery Two</option>
- </select>
- <input type="button" name="class_submit" value="GO">
- </form>
- <form action="" method="POST">
- <?php
- if (ISSET($_POST['class'])) {
- $class = mysqli_real_escape_string($con, $_POST['class']);
- $student_name = mysqli_query($con, "SELECT * FROM stu_tbl WHERE `class` = '.$class.'");
- // your remaining script
- // fetch your option here
- echo '<input type="hidden" name="class" value="'.$class.'">';
- }
- ?>
- <input type="submit" name="submit" value="submit">
- </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement