Expand|Select|Wrap|Line Numbers
- <form action="handle_event.php" method="POST" enctype="multipart/form-data">
- <table id="event_edit" border="0">
- <tr>
- <td>
- <label for="title">TITLE: </label>
- </td>
- <td class="input">
- <input id="title" name="title" type="text" size="80" value="<?php if (!empty($title)) {echo $title;} ?>" />
- </td>
- </tr>
- <tr>
- <td>
- <label for="description">DESCRIPTION: </label>
- </td>
- <td class="input">
- <textarea id="description" name="description" cols="60" rows="10"><?php if ($id) {echo $description;} ?></textarea>
- </td>
- </tr>
- <tr>
- <td><label for="userfile">IMAGE: </label><?php if (!empty($filename)) echo $filename ?></td>
- <td class="input"><input type="file" name="userfile" class="picture" size="67"></td>
- </tr>
- <tr><td> </td></tr>
- <tr>
- <td colspan="2">
- <div id="admin_buttons">
- <input type="hidden" name="id" value="<?php if (isset($_GET['id'])) echo $_GET['id']; ?>" />
- <input type="hidden" name="submitted" value="TRUE" />
- <input type="image" name="delete" value="delete" src="../images/delete_button.gif" class="admin_button" onclick="return confirm('Are you sure you want to delete this event?');" />
- <input type="image" name="update" value="update" src="../images/update_button.gif" class="admin_button" />
- <input type="image" name="add" value="add" src="../images/add_button.gif" class="admin_button" />
- <a href="event.php">
- <input type="image" name="clear" value="clear" src="../images/clear_button.gif" class="admin_button" />
- </a>
- </div>
- </td>
- </tr>
- </table>
- </form>
Expand|Select|Wrap|Line Numbers
- $add_x = $_POST['add_x'];
- $add_y = $_POST['add_y'];
- $update_x = $_POST['update_x'];
- $update_y = $_POST['update_y'];
- $delete_x = $_POST['delete_x'];
- $delete_y = $_POST['delete_y'];
- if (!empty($add_x) || !empty($add_y)) {
- $action = add;
- } else if (!empty($update_x) || !empty($update_y)) {
- $action = update;
- } else if (!empty($delete_x) || !empty($delete_y)) {
- $action = delete;
- }
- $id = $_POST['id'];
- $title = $_POST['title'];
- $description = $_POST['description'];
- if (!empty($_FILES['userfile'])) {
- $filename = $_FILES['userfile']['name'];
- $tmpname = $_FILES['userfile']['tmp_name'];
- $filesize = $_FILES['userfile']['size'];
- $filetype = $_FILES['userfile']['type'];
- $error = $_FILES['userfile']['error'];
- $fp = fopen($tmpname, 'r+');
- $content = fread($fp, fileSize($tmpname));
- $content = addslashes($content);
- fclose($fp);
- if(!get_magic_quotes_gpc()) {
- $filename = addslashes($filename);
- }
- }
- switch ($action) {
- case "add":
- $msgHead = "Add an Event";
- /* do a bunch of stuff */
- break;
- case "update":
- $msgHead = "Update an Event";
- /* do a bunch of stuff */
- break;
- case "delete":
- $msgHead = "Delete an Event";
- /* do a bunch of stuff */
- break;
- default:
- echo 'Page accessed in error.';
- break;
- }