Esempio n. 1
0
function editPage($id)
{
    include_once 'login.php';
    include_once 'database_conn.php';
    include_once 'showEventFunction.php';
    $pageHeader = "Event Edit Page";
    $sql = "SELECT * FROM te_events WHERE eventID = {$id}";
    $rslt = mysqli_query($conn, $sql) or die(mysqli_error($conn));
    // error message return if return empty result
    $row = mysqli_fetch_row($rslt);
    $venues = getFromDb($conn, "SELECT * FROM te_venue");
    $categories = getFromDb($conn, "SELECT * FROM te_category");
    $output = "<h1>{$pageHeader}</h1>";
    $i = 1;
    $output .= "<form id=\"editForm\" action=\"handleEditPage.php\" method=\"post\">";
    $output .= "<table border=0 >";
    $output .= createRowData("Title", createTextField("title", $row[$i++]));
    $output .= createRowData("Description", createTextArea("desc", $row[$i++], 5, 40));
    $output .= createRowData("Venue Name", createCombobox("venue", $row[$i++], $venues));
    $output .= createRowData("Category", createCombobox("category", $row[$i++], $categories));
    $output .= createRowData("Start Time", createDate("startTime", $row[$i++]));
    $output .= createRowData("End Time", createDate("endTime", $row[$i++]));
    $output .= createRowData("Price", createTextField("price", $row[$i++]));
    $output .= "<tr><td><input type=\"submit\" name=\"submit\" value=\"Submit\"></td></tr>";
    $output .= "<input type=\"hidden\" name=\"e_id\" value=\"{$id}\">";
    $output .= "</table></form>";
    mysqli_free_result($rslt);
    mysqli_close($conn);
    return $output;
}
Esempio n. 2
0
function searchPage()
{
    include_once 'login.php';
    include_once 'database_conn.php';
    include_once 'showEventFunction.php';
    $pageHeader = "Search Page";
    $backURL = "<br/><a href = \"index.php\">Back to Home</a>";
    $venues = getFromDb($conn, "SELECT * FROM te_venue");
    $categories = getFromDb($conn, "SELECT * FROM te_category");
    $output = "<h1>{$pageHeader}</h1>";
    $output .= "<form id=\"searchForm\" action=\"handleSearchPage.php\" method=\"post\">";
    $output .= "<table border=0 >";
    $output .= createRowData("Title", createTextField("title", ""));
    $output .= createRowData("Venue Name", createCombobox("venue", "", $venues));
    $output .= createRowData("Category", createCombobox("category", "", $categories));
    $output .= createRowData("Start Time", createDate("startTime", ""));
    $output .= createRowData("End Time", createDate("endTime", ""));
    $output .= createRowData("Price", createTextField("price", ""));
    $output .= "<tr><td><input type=\"submit\" name=\"submit\" value=\"Search\"></td></tr>";
    $output .= "</table></form>";
    return $output . $backURL;
}