Ejemplo n.º 1
0
    insert_docs($id);
} elseif (isset($_POST['submit_text'])) {
    $comments = $_POST['comments'];
    insert_text($id);
} elseif (isset($_POST['submit_lp'])) {
    insert_lp($id);
} elseif (isset($_POST['submit_video'])) {
    insert_video($id);
} elseif (isset($_POST['submit_exercise'])) {
    insert_exercise($id);
} elseif (isset($_POST['submit_work'])) {
    insert_work($id);
} elseif (isset($_POST['submit_forum'])) {
    insert_forum($id);
} elseif (isset($_POST['submit_poll'])) {
    insert_poll($id);
} elseif (isset($_POST['submit_wiki'])) {
    insert_wiki($id);
} elseif (isset($_POST['submit_link'])) {
    insert_link($id);
} elseif (isset($_POST['submit_ebook'])) {
    insert_ebook($id);
}


switch ($_GET['type']) {
    case 'work': $pageName = "$langAdd $langInsertWork";
        include 'insert_work.php';
        list_assignments();
        break;
    case 'doc': $pageName = "$langAdd $langInsertDoc";
Ejemplo n.º 2
0
<?php

include 'get_connection.php';
try {
    $author = $_GET['author'];
    $question = $_GET['question'];
    $state = isset($_GET['state']) ? $_GET['state'] : -1;
    $county = isset($_GET['county']) ? $_GET['county'] : -1;
    $city = isset($_GET['city']) ? $_GET['city'] : -1;
    insert_poll($conn, $author, $question, $state, $county, $city);
} catch (PDOException $e) {
    echo "Connection failed: " . $e->getMessage();
    return;
}
$conn = null;
function insert_poll($conn, $author, $question, $state, $county, $city)
{
    $query = "INSERT INTO polls (author, question, state, county, city) VALUES (:author,:question,:state,:county,:city);";
    $stmt = $conn->prepare($query);
    $stmt->bindparam(':author', $author);
    $stmt->bindparam(':question', $question);
    $stmt->bindparam(':state', $state);
    $stmt->bindparam(':county', $county);
    $stmt->bindparam(':city', $city);
    $stmt->execute();
}