function show_left() { global $searchform; output_block_start('Search Titles'); form_display($searchform); output_block_end(); output_block_start('Sort by'); echo '<ul>'; showSortLink(1, "Newest"); showSortLink(2, "Popular"); showSortLink(3, "Longest"); echo '</ul><ul>'; showDateLink(1, "Today"); showDateLink(2, "This week"); showDateLink(3, "This month"); showDateLink(4, "All time"); echo '</ul>'; output_block_end(); }
function db_create_form_generation($connection, $table) { $connection = $connection; $table = $table; $fields = ""; function form_field_generation($connection, $table) { $connection = $connection; $table = $table; // Need to create a loop here to make a different input for each field. $fields_query = "SHOW COLUMNS "; $fields_query .= "FROM {$table}"; $fields = mysqli_query($connection, $fields_query); $fields = mysqli_fetch_all($fields); //Not necessary? //echo "<h2>" . ucwords($table) . "</h2>" . "<td class='data_output'>" . "<table>"; // Not necessary? if (!$fields) { die("Error displaying data."); } else { //echo "Debugging: "; //echo "<tr>"; for ($i = 0; $i < count($fields); $i++) { //echo "<td class='data_output_headers'>"; $formatted_fields = ucwords($fields[$i][0]); //print_r($formatted_fields); //echo "</td>"; } //echo "</tr>"; } return $fields; } function form_display($connection, $table, $fields) { $connection = $connection; $table = $table; $fields = $fields; // Defining display here instead of passing may be repetitive $display = $_GET['display']; //Debugging /* if ($table == "clients") { echo "<h2>Add " . ucwords($table) . "</h2>"; echo "<form action='' method='post'> Last Name: <input type='text' name='last_name' value=''/><br/> First Name: <input type='text' name='first_name' value=''/><br/> Middle Name: <input type='text' name='middle_name' value=''/><br/> Prefix: <input type='text' name='name_affix' value=''/><br/> Suffix: <input type='text' name='name_suffix' value=''/><br/> Agency: <input type='text' name='agency' value=''/><br/> Case Manager: <input type='text' name='case_manager' value=''/><br/> Point of Contact: <input type='text' name='point_of_contact' value=''/><br/> <p><input type='submit' name='submit' value='Add'/></p> </form>"; } else { } */ $form = "<h2>Add " . ucwords($table) . "</h2>"; $form .= "<form action='' method='post'>"; for ($i = 1; $i < count($fields); $i++) { $field = $fields[$i][0]; $form .= ucwords($field) . ": <input type='text' name='{$field}' value=''/><br/>"; } $form .= "<p><input type='button' id='cancel_button' name='cancel' value='Cancel'/>"; $form .= "<input type='submit' name='submit' value='Add " . ucwords($display) . "'/></p>\n \t\t\t\t\t</form>"; echo $form; } $fields = form_field_generation($connection, $table); form_display($connection, $table, $fields); }
<?php mod('form'); $form = form_create('Continue', 'default', 'process_form', 'post'); function process_form() { global $form, $root, $userid; $f = $_FILES['file']; $name = $f['name']; $f['name'] = md5(rand(0, 1000000000)); $path = $root . '/uploads/midi/' . $f['name']; if (!move_uploaded_file($f['tmp_name'], $path)) { form_add_error($form, 'Error uploading file.'); } else { header('Location: /import2/' . $f['name'] . '?title=' . urlencode($name)); exit; } } form_add_param($form, 'File', 'file', 'file;mid;20000000', '', 100, 14); form_process(); output_header("Upload MIDI File"); output_block_start("Upload MIDI File"); echo '<p>Keep in mind that not all MIDI files will work well! Many MIDI files use features that are not supported by the sequencer; simple ones work best.</p>'; echo '<p>Examples: <a href="http://onlinesequencer.net/4679">Baba Yetu</a>, <a href="http://onlinesequencer.net/4680">Fangad aven korvring</a>, <a href="http://onlinesequencer.net/4681">Cliffs of Dover</a></p>'; form_display($form); output_block_end(); output_footer();