PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Wed Jul 08, 2020 9:39 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Wed Mar 25, 2015 12:59 pm 
Offline
Forum Newbie

Joined: Wed Mar 25, 2015 12:50 pm
Posts: 1
Hello,

I am implementing a system to record minutes of meetings between a student and a supervisor.
A student can have a number of sets of minutes and the supervisor involved in the meetings will also have access and editing capabilities. So far I am able to print all minutes, for the currentUser that is logged in, you can delete each set, view them individually, but the part that is throwing me an error is when you try to edit them. I have attached the corresponding code below, It is throwing me an error saying the $ID is an undefined index, but in my eyes it is ? Any help would be much appreciated.

(code for minutes.php)

Syntax: [ Download ] [ Hide ]
<?php
        $dbQuery = $db->prepare("select * from minute where '$currentUser'=B_number ");
        $dbQuery->execute();
       
        $numMinutes = $dbQuery->rowCount();

        echo "<p>There are $numMinutes sets of minutes in the system</p>";

        $oddRow=true;
        while ($dbRow = $dbQuery->fetch(PDO::FETCH_ASSOC)) {
                $ID               = $dbRow['ID'];
        $B_number = $dbRow['B_number'];
        $Date  = $dbRow['Date'];
        $Time  = $dbRow['Time'];
        $Discussion = $dbRow['Discussion'];
                $Actions = $dbRow['Actions'];
                $Dateofnextmeeting = $dbRow['Dateofnextmeeting'];
                $Status = $dbRow['Status'];
                $E_number = $dbRow['E_number'];
                $Supervisor_comments = $dbRow['Supervisor_comments'];

               
        if ($oddRow) $rowClass="odd"; else $rowClass="even";
        $oddRow=!$oddRow;
   
        if (isset($_POST['editMinuteID']) && $_POST['editMinuteID']==$ID) {
                echo "<tr class='$rowClass '>
                      <form style='display:inline' method='post' action='minutes.php'>
                    <input type='hidden' name='editCommitID' value='$ID'>
                    <td><input type='varchar' name='editB_number' value='$B_number'></td>
                    <td><input type='date' name='editDate' value='$Date'></td>
                                        <td><input type='time' name='editTime' value='$Time'></td>
                    <td><input type='text' name='editDiscussion' value='$Discussion'></td>
                                        <td><input type='text' name='editActions' value='$Actions'></td>
                                        <td><input type='date' name='editDateofnextmeeting' value='$Dateofnextmeeting'></td>
                                        <td><input type='enum' name='editStatus' value='$Status'></td>
                                        <td><input type='varchar' name='editE_number' value='$E_number'></td>
                                        <td><input type='text' name='editSupervisor_comments' value='$Supervisor_comments'></td>
                    <td colspan='2'><input type='image' src='edit.png'>
                 </form>
                 </tr>"
;      
        } else {
               
                echo "<tr class='$rowClass'><td>$B_number</td><td>$Date</td><td>$Time</td><td>$Discussion</td><td>$Actions</td><td>$Dateofnextmeeting</td><td>$Status</td><td>$E_number</td><td>$Supervisor_comments</td>
                      <td class='operation'>
                         <form class='display:inline' method='post' action='viewstudentminutes.php'>
                         <input type='hidden' name='editMinute_ID' value='$ID'>
                         <input type='image' src='edit.png' style='padding-top:7px'>
                         </form></td>
                      <td class='operation'>
                         <form class='display:inline' method='post' action='minutes.php'  
                                   onsubmit='return confirm(\"Are you sure?\")'>
                         <input type='hidden' name='deleteMinuteID' value='$ID'>
                         <input type='image' src='delete.png' style='padding-top:7px'>
                         </form></td>
                                                 <td class='operation'>
                         <form class='display:inline' method='post' action='viewstudentminutes.php' onsubmit='viewstudentminutes.php'>
                                                <input type='image' src='view.png' style='padding-top:7px'>
                                                <input type='hidden' name='ID' value='"
. $ID . "'>
</form></td>
                  </tr>"
;
        }        
        }[/color]
                                       

?>


(code for viewminutes.php)

Syntax: [ Download ] [ Hide ]
<?php
         
                       
        $dbQuery= $db->prepare("SELECT * FROM `Minute` WHERE `B_number` = '" . $currentUser . "' AND `ID` = " . $_POST['ID']);
        $dbQuery->execute();
   
               
        $oddRow=true;
        while ($dbRow = $dbQuery->fetch(PDO::FETCH_ASSOC)) {
                $ID               = $dbRow['ID'];
        $B_number = $dbRow['B_number'];
        $Date  = $dbRow['Date'];
        $Time  = $dbRow['Time'];
        $Discussion = $dbRow['Discussion'];
                $Actions = $dbRow['Actions'];
                $Dateofnextmeeting = $dbRow['Dateofnextmeeting'];
                $Status = $dbRow['Status'];
                $E_number = $dbRow['E_number'];
                $Supervisor_comments = $dbRow['Supervisor_comments'];

               
        if ($oddRow) $rowClass="odd"; else $rowClass="even";
        $oddRow=!$oddRow;
               
               
                 
                if (isset($_POST['editMinuteID']) && $_POST['editMinuteID']==$ID) {
                echo "<tr class='$rowClass'>
                      <form style='display:inline' method='post' action='viewstudentminutes.php'>
                    <input type='hidden' name='editCommitID' value='$ID'>
                     <tr><td colspan='2'><input type='image' src='edit.png'></tr>
                                         <tr><th>MinuteID</th><td><input type='varchar' name='editMinute_ID' value='$ID'></td></tr>
                                         <tr><th>BNumber</th><td><input type='varchar' name='editB_number' value='$B_number'></td></tr>
                    <tr><th>Date</th><td><input type='date' name='editDate' value='$Date'></td></tr>
                                        <tr><th>Time</th><td><input type='time' name='editTime' value='$Time'></td></tr>
                    <tr><th>Discussion</th><td><input type='text' name='editDiscussion' value='$Discussion'></td></tr>
                                        <tr><th>Actions</th><td><input type='text' name='editActions' value='$Actions'></td></tr>
                                        <tr><th>Date of Next Meeting</th><td><input type='date' name='editDateofnextmeeting' value='$Dateofnextmeeting'></td></tr>
                                        <tr><th>Status</th><td><input type='enum' name='editStatus' value='$Status'></td></tr>
                                        <tr><th>E Number</th><td><input type='varchar' name='editE_number' value='$E_number'></td></tr>
                                        <tr><th>Supervisor Comments</th><td><input type='text' name='editSupervisor_comments' value='$Supervisor_comments'></td></tr>
                   
                 </form>
                 </tr>"
;      
        } else {
                echo "<tr class='$rowClass'>
                                        <td class='operation'>
                         <form class='display:inline' method='post' action='viewstudentminutes.php'>
                         <input type='hidden' name='editMinute_ID' value='$ID'>
                         <input type='image' src='edit.png' style='padding-top:7px'>
                         </form></td>
                                        <tr><th>BNumber</th><td>$B_number</td></tr>
                                        <tr><th>Date</th><td>$Date</td></tr>
                                        <tr><th>Time</th><td>$Time</td></tr>
                                        <tr><th>Discussion</th><td>$Discussion</td></tr>
                                        <tr><th>Actions</th><td>$Actions</td></tr>
                                        <tr><th>Date of Next Meeting</th><td>$Dateofnextmeeting</td></tr>
                                        <tr><th>Status</th><td>$Status</td></tr>
                                        <tr><th>E Number</th><td>$E_number</td></tr>
                                        <tr><th>Supervisor Comments</th><td>$Supervisor_comments</td></tr>
                  </tr>"
;
        }        
        }
       
?>


Please help :(


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group