Jump to content

Dave2433

New Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by Dave2433

  1. I dont know where to put this controller in my index my proffessor wants this in and I dont know where to put it and why.

    $action == 'list_students'
     

    My index so far

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="utf-8">
        <title>Davids Database</title>
        <!--  
        David Malone
        Computer Science 4000
        -->
        <link rel="stylesheet" href="../style.css">
    </head>
    <body>
    <?php
    include ('../view/Header.php');
    ?>

    <section>


    <table style ="width: 500px">
    <tr>
        <td style ="width: 100px"><b>StudentID</b></td>
        <td style ="width: 100px"><b>MajorID</b></td>
        <td style ="width: 100px"><b>FirstName</b></td>
        <td style ="width: 100px"><b>LastName</b></td>
        <td><b>Gender</b></td>
    </tr>
    </table>
    $action == list_students
    <?php 
    require ('delete.php');
    require ('../model/major.php');

        /* First time running page
           This generates the table */
        if (isset($_GET['majorID'])){}
        else
        getID(1);

        /* Detects when buttons are clicked and calls function using value in button */
        if (array_key_exists('DELETE', $_POST))
        {
            $student_id = $_POST ['DELETE'];
            delStudent($student_id);
        }
        
        if (array_key_exists('majorID', $_GET))
        {
            $majorID = $_GET ['majorID'];
            getID($majorID);
        }
        

    ?>


    <a href="../student_manager/add student.php">Add Student</a><br>

    <form action="" method"get">
        <button type="submit" name="majorID" value="1"> Show Computer Science Majors</button><br><br>
        <button type="submit" name="majorID" value="2"> Show Electrical Engineering Majors</button><br><br>
        <button type="submit" name="majorID" value="3"> Show Business Majors</button>
    </form>

    </section>

    <?php
    include ('../view/Footer.php');
    ?>

    </body>
    </html>

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.