48 lines
876 B
PHP
48 lines
876 B
PHP
<?php
|
|
//Martin Lenzelbauer, 2005
|
|
define(ROOT, "../");
|
|
require_once(ROOT.'cms/include/db.inc.php');
|
|
require_once(ROOT.'cms/include/template.inc.php');
|
|
|
|
if($query = createQuery()){
|
|
$result = dbQuery($query);
|
|
if(!$result){
|
|
die(mysql_error());
|
|
}
|
|
}
|
|
printConfirm();
|
|
|
|
|
|
//Stellt INSERT statement zusammen
|
|
function createQuery(){
|
|
$query = "INSERT INTO umfrage_PROgramm (";
|
|
$vars;
|
|
$values;
|
|
//alle Formulardaten in die query schreiben
|
|
foreach($_POST as $i=>$j){
|
|
if(!empty($j) && $i != 'submit'){
|
|
$vars .= "$i, ";
|
|
$values .= "'$j', ";
|
|
}
|
|
}
|
|
//es gibt keine Formulardaten
|
|
if(empty($vars)){
|
|
return false;
|
|
}
|
|
$query .= substr($vars,0,strlen($vars)-2);
|
|
$query .= ") values (";
|
|
$query .= substr($values,0,strlen($values)-2);
|
|
$query .= ")";
|
|
return $query;
|
|
}
|
|
|
|
//Bestätigung ausgeben
|
|
function printConfirm(){
|
|
$t = new Template("danke.html");
|
|
$t->parse();
|
|
}
|
|
|
|
|
|
|
|
?>
|