Jump to content

Recommended Posts

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>

2 hours ago, Dave2433 said:

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.

Have you tried asking your professor? Or a classmate? Because if this is related to some class work then it's going to be hard for us to know what it is you're expected to do...

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.