Search for a bad quote by prof: <input type="text" name="search" value="<?php echo $_POST['search'] ? $_POST['search'] : ""; ?> " /> <br />Term <select name="term"><option>Spring</option><option>Fall</option><option>Winter</option></select> <input type="text" name="syear" value="<?php echo $_POST['syear'] ? $_POST['syear'] : ""; ?> " /> <br /><input type="submit" name="submit" value="Search" /> <?php if ($_POST['submit']) { // Need to search by term/year too // Need new search/better. search should accept "stuff?stuff?" or something $quotes = $update->getQuotes($_POST['search']); echo "<table><tr><th>Quote</th><th>Prof</th><th>Course</th><th>Term/Year</th></tr>\n"; foreach ($quotes as $quote) { echo "<tr><td><input type='text' name='quote[]' value=\"" . $quote['quote'] . "\" /></td>"; echo "<td><input type='text' name='prof[]' value='" . $quote['prof'] . "' /></td>"; echo "<td><input type='text' name='course[]' value='" . $quote['course'] . "' /></td>"; echo "<td><select name='term[]'><option>" . $quote['term'] . "</option><option>Winter</option><option>Spring</option><option>Fall</option></select> "; echo "<input type='text' name='year[]' value='" . $quote['year'] . "' /></td></tr>"; } echo "</table>"; echo "<input type='submit' name='update' value='Update Quotes' />"; } else { if ($_POST['update']) { echo "<pre>"; print_r($_POST); echo "</pre>";
echo "<p class='searchresult'>You searched for: <b>" . $search['prof'] . "</b> "; echo $search['exact'] ? "(exact) " : "(partial) "; if (!$search['rand']) { echo "and sorted by <b>" . $search['sort'] . "</b>."; } else { echo "and chose to be <b>rAnDoM</b>!"; } if (intval($search['limit'])) { echo " Returning " . intval($search['limit']) . " results.</p>\n\n"; } else { echo " Returning all results.</p>\n\n"; } } else { echo "<p>You searched for nothing! Try again, noob</p>\n\n"; } $quotes = $Q->getQuotes($search); } else { $search = $_SESSION['search']; ?> <p>Search for your favourite profs! If you encounter any issues, please contact <a href="mailto:rjputins@csclub.uwaterloo.ca">rjputins</a></p> <div class="search"> <form method="post" action="index.php"> <h1>Search Filters</h1> <p>Type 'all' in the search box to get all quotes.</p> <p><label>Search by prof</label><input type="text" name="search[prof]" value="<?php echo $search['prof'] ? $search['prof'] : ""; ?> " style="width:300px;" /> <input type="checkbox" name="search[exact]" /> Exact match?</p> <p><label>Sort by</label><select name="search[sort]"><?php echo $search['sort'] ? "<option>" . $search['sort'] . "</option>" : "";