Last active
August 29, 2015 14:21
-
-
Save Luguan/535353094cc15c2f8888 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$dbh = new PDO('mysql:host=julkalender3d.se.mysql;dbname=julkalender3d_s', 'julkalender3d_s', 'amax3Ds'); | |
if (isset($_POST['Field4'])) | |
{ | |
$franvaro=htmlspecialchars($_POST['field106']); | |
if ($_POST['Field106']=="Second Choice") | |
$franvaro="Närvarande"; | |
else if ($_POST['Field106']=="Third Choice") | |
$franvaro="Sen ankomst"; | |
else if ($_POST['Field106']=="Forth Choice") | |
$franvaro="Frånvarande"; | |
$uppgift; | |
$extra= $_POST['text']; | |
for ($i=0; $i<count($extra); $i++){ | |
$extra[$i]= $extra[$i]; | |
$uppgift=$uppgift." ".$extra[$i]; | |
} | |
addItems($_SESSION['username'], date("Ymd"), $_POST['Field4'], $franvaro, $uppgift); | |
echo '<script language="javascript">'; | |
echo 'alert("message successfully sent")'; | |
echo '</script>'; | |
} | |
function addItems($user, $today, $kommentar, $franvaro, $uppgift){ | |
global $dbh; | |
$addStmt = $dbh->prepare('INSERT INTO Arbetsuppgift(Date, Namn, Kommentar, Narvaro, Extrauppgift) VALUES(:date, :username, :kommentar, :narvaro, :uppgift)'); | |
$addStmt->bindValue (':date', $today); | |
$addStmt->bindValue (':username', $user); | |
$addStmt->bindValue (':kommentar', $kommentar); | |
$addStmt->bindValue (':narvaro', $$franvaro); | |
$addStmt->bindValue (':uppgift', $uppgift); | |
return $addStmt->execute(); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment