[Openfirst-cvscommit] awards/admin index.php,1.5,1.6
Brought to you by:
xtimg
From: <xt...@us...> - 2003-07-23 21:08:44
|
Update of /cvsroot/openfirst/awards/admin In directory sc8-pr-cvs1:/tmp/cvs-serv29308 Modified Files: index.php Log Message: Add ability to modify existing awards to award module. Index: index.php =================================================================== RCS file: /cvsroot/openfirst/awards/admin/index.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** index.php 29 Jun 2003 03:38:17 -0000 1.5 --- index.php 23 Jul 2003 21:08:37 -0000 1.6 *************** *** 52,55 **** --- 52,76 ---- } + // If the user has submitted modifications to an award, then make them. + + if (ISSET($_POST['modify'])){ + mysql_query("UPDATE ofirst_awards SET AwardName='".$_POST['award']."', + Event = '".$_POST['event']."', + Date = '".$_POST['date'] . "', + Image = '".$_POST['type']."', + Recipient = '".$_POST['recipient']."' WHERE ID='" . $_POST["AwardID"] . "';") + or die("UPDATE: ".mysql_error()); + + echo("<p></p>Award modifications submitted! [ <a href='./'>Manage Award</a> ]</p>"); + die(include($footer)); + } + + + // If the user has elected to modify an award, fill the form with those details. + if(isset($_GET["MODIFY"])) { + $award = mysql_fetch_object(mysql_query("SELECT * FROM ofirst_awards WHERE ID='" . $_GET["MODIFY"] . "';")); + } else { + $award = ""; + } ?> *************** *** 61,82 **** <tr> <th> </th> ! <th>Add A New Award</th> </tr> <tr> <th>Award Name</th> ! <td><input name="award" type="text" id="award"></td> </tr> <tr> <th>Regional/Event</th> ! <td><input name="event" type="text" id="event"></td> </tr> <tr> <th>Date</th> ! <td><input name="date" type="text" id="date" value="<?php echo date("Y-n-j"); ?>" size="10"> <sub>(Use this syntax: Year-Month-Day)</sub></td> </tr> <tr> <th>Recipient</th> ! <td><input name="recipient" type="text" id="recipient" value="Team Award"></td> </tr> <tr> --- 82,119 ---- <tr> <th> </th> ! <th><?php ! if ($award == "") { ! echo("Add A New Award"); ! } else { ! echo("Modify an Existing Award ! <input type='hidden' id='AwardID' name='AwardID' value='$award->ID'>"); ! } ?></th> </tr> <tr> <th>Award Name</th> ! <td><input name="award" type="text" id="award" value="<?php echo $award->AwardName; ?>"></td> </tr> <tr> <th>Regional/Event</th> ! <td><input name="event" type="text" id="event" value="<?php echo $award->Event; ?>"></td> </tr> <tr> <th>Date</th> ! <td><input name="date" type="text" id="date" value="<?php ! if($award == "") { ! echo date("Y-n-j"); ! } else { ! echo $award->Date; ! } ?>" size="10"> <sub>(Use this syntax: Year-Month-Day)</sub></td> </tr> <tr> <th>Recipient</th> ! <td><input name="recipient" type="text" id="recipient" value="<?php ! if($award == "") { ! echo ("Team Award"); ! } else { ! echo $award->Recipient; ! } ?>"></td> </tr> <tr> *************** *** 103,107 **** <tr> <td> </td> ! <td><input name="create" type="submit" id="create" value="Create Listing"></td> </tr> </table> --- 140,148 ---- <tr> <td> </td> ! <?php if($award == "") { ?> ! <td><input name="create" type="submit" id="create" value="Create Listing"></td> ! <?php } else { ?> ! <td><input name="modify" type="submit" id="modify" value="Modify Listing"></td> ! <?php } ?> </tr> </table> *************** *** 127,132 **** <td><?php echo $awards->Date; ?></td> <td><?php echo $awards->Recipient; ?></td> ! <td><div align="center">[ <a href='./?DELETE=<?php echo $awards->ID; ?>'>Delete</a> ! ]</div></td> </tr> <?php --- 168,172 ---- <td><?php echo $awards->Date; ?></td> <td><?php echo $awards->Recipient; ?></td> ! <td><div align="center">[ <a href='./?DELETE=<?php echo $awards->ID; ?>'>Delete</a> | <a href='./?MODIFY=<?php echo $awards->ID; ?>'>Modify</a> ]</div></td> </tr> <?php |