Hallo!
Ich kämpfe heute schon den ganzen Tag mit meinen Checkboxen im FE Formular.
Wenn ich nur eine anklicke passt alles.
Doch wen ich z.B. Checkbox 1 (= value 1) und 3 (=value 4) anklicke wird nicht 5 sondern nur 4 in die Db geschrieben?
Was übersehe ich? Was muss ich da noch tun? Google & Co. gibts absolut nix mehr her... ich bin da am verzweifeln...
Mein code in der ...pi1.php:
<?php
/***************************************************************
* Copyright notice
*
* (c) 2009 [Name entfernt]
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* [CLASS/FUNCTION INDEX of SCRIPT]
*
* Hint: use extdeveval to insert/update function index above.
*/
require_once(PATH_tslib.'class.tslib_pibase.php');
/**
* Plugin 'Hirsch Inn Poll' for the 'jpg_hirschinnpoll' extension.
*
* @author [Name entfernt]
* @package TYPO3
* @subpackage tx_jpghirschinnpoll
*/
class tx_jpghirschinnpoll_pi1 extends tslib_pibase {
var $prefixId = 'tx_jpghirschinnpoll_pi1'; // Same as class name
var $scriptRelPath = 'pi1/class.tx_jpghirschinnpoll_pi1.php'; // Path to this script relative to the extension dir.
var $extKey = 'jpg_hirschinnpoll'; // The extension key.
/**
* The main method of the PlugIn
*
* @param string $content: The PlugIn content
* @param array $conf: The PlugIn configuration
* @return The content that is displayed on the website
*/
function main($content, $conf) {
$this->conf = $conf;
$this->pi_setPiVarDefaults();
$this->pi_loadLL();
$this->pi_USER_INT_obj = 1; // Configuring so caching is not expected. This value means that no cHash params are ever set. We do this, because it's a USER_INT object!
//Wenn via TS Formularanzeige gesetzt
//if($this->conf['viewer'] == "form") {
//debugging wenn button übergeben
if(isset($this->piVars[submit_button]))
{
//t3lib_div::debug($this->piVars);
//UMWANDLUNG GEBURTSTAG WENN IN DER FORM YYYY-MM-DD
$this->piVars['DATA']['geburtstag'] = strtotime($this->piVars['DATA']['geburtstag']);
//AKTUELLES EINTRAGSDATUM
$date_aktuell = time();
$query ='INSERT INTO
tx_jpghirschinnpoll_umfrage (date,name,ort,geschlecht,geburtstag,email,wann_ausgehen,events,music,friendly_door,friendly_bar,friendly_service,drinkquality,foodquality,prices,ambiente,djs,clean,partythemes,general,howfound,howinform,wishes,good,bad,pid)
VALUES
("'.$date_aktuell.'",
"'.addslashes($this->piVars['DATA']['name']).'",
"'.addslashes($this->piVars['DATA']['ort']).'",
"'.addslashes($this->piVars['DATA']['geschlecht']).'",
"'.addslashes($this->piVars['DATA']['geburtstag']).'",
"'.addslashes($this->piVars['DATA']['email']).'",
"'.addslashes($this->piVars['DATA']['wann_ausgehen']).'",
"'.addslashes($this->piVars['DATA']['events']).'",
"'.addslashes($this->piVars['DATA']['music']).'",
"'.addslashes($this->piVars['DATA']['friendly_door']).'",
"'.addslashes($this->piVars['DATA']['friendly_bar']).'",
"'.addslashes($this->piVars['DATA']['friendly_service']).'",
"'.addslashes($this->piVars['DATA']['drinkquality']).'",
"'.addslashes($this->piVars['DATA']['foodquality']).'",
"'.addslashes($this->piVars['DATA']['prices']).'",
"'.addslashes($this->piVars['DATA']['ambiente']).'",
"'.addslashes($this->piVars['DATA']['djs']).'",
"'.addslashes($this->piVars['DATA']['clean']).'",
"'.addslashes($this->piVars['DATA']['partythemes']).'",
"'.addslashes($this->piVars['DATA']['general']).'",
"'.addslashes($this->piVars['DATA']['howfound']).'",
"'.addslashes($this->piVars['DATA']['howinform']).'",
"'.addslashes($this->piVars['DATA']['wishes']).'",
"'.addslashes($this->piVars['DATA']['good']).'",
"'.addslashes($this->piVars['DATA']['bad']).'",
"'.$GLOBALS['TSFE']->id.'")';
$res = mysql(TYPO3_db, $query);
echo mysql_error();
header ('Location: '.t3lib_div::locationHeaderUrl('index.php?id=407'));
} else {
$content='
<h3>This is a form:</h3>
<form action="'.$this->pi_getPageLink($GLOBALS['TSFE']->id).'" method="POST">
<input type="hidden" name="no_cache" value="1">
<!--//TABELLE MIT FELDERN FÜR INPUT-->
<table width="100%" border="1" cellspacing="2" cellpadding="0">
<tr>
<td>
Name:
</td>
<td>
<input type="text" name="'.$this->prefixId.'[DATA][name]" value="">
</td>
</tr>
<tr>
<td>
Ort:
</td>
<td>
<input type="text" name="'.$this->prefixId.'[DATA][ort]" value="">
</td>
</tr>
<tr>
<td>
Geschlecht:
</td>
<td>
<select name="'.$this->prefixId.'[DATA][geschlecht]">
<option value="0">Weiblich</option>
<option value="1">Männlich</option>
</td>
</tr>
<tr>
<td>
Geburtstag:
</td>
<td>
<input type="text" name="'.$this->prefixId.'[DATA][geburtstag]" value="JJJJ-MM-TT">
</td>
</tr>
<tr>
<td>
E-Mail:
</td>
<td>
<input type="text" name="'.$this->prefixId.'[DATA][email]" value="">
</td>
</tr>
<tr>
<td>
Wann geshst du in der Regel aus?:
</td>
<td>
<table>
<tr><td><INPUT type=radio name="'.$this->prefixId.'[DATA][wann_ausgehen]" value="1"> Wochenende </td></tr>
<tr><td><INPUT type=radio name="'.$this->prefixId.'[DATA][wann_ausgehen]" value="2"> unter der Woche </td></tr>
<tr><td><INPUT type=radio name="'.$this->prefixId.'[DATA][wann_ausgehen]" value="3"> beides </td></tr>
</table>
</td>
</tr>
<tr>
<td style="background-color:red;">
Welche Art von Events bevorzugst du?
</td>
<td style="background-color:red;">
<table>
<tr><td><INPUT type="checkbox" name="'.$this->prefixId.'[DATA][events]" value="1"> Party </td>
<td><INPUT type="checkbox" name="'.$this->prefixId.'[DATA][events]" value="2"> Konzert </td>
<td><INPUT type="checkbox" name="'.$this->prefixId.'[DATA][events]" value="4"> Tanzabend </td></tr>
</table>
</td>
</tr>
<tr>
<td style="background-color:red;">
Auf welche Musikrichtung stehst du?
</td>
<td style="background-color:red;">
<table><tr>
<td><INPUT type="checkbox" name="'.$this->prefixId.'[DATA][music]" value="1"> Charts </td>
<td><INPUT type="checkbox" name="'.$this->prefixId.'[DATA][music]" value="2"> RnB </td>
<td><INPUT type="checkbox" name="'.$this->prefixId.'[DATA][music]" value="4"> Black </td>
<td><INPUT type="checkbox" name="'.$this->prefixId.'[DATA][music]" value="8"> Rock </td>
<td><INPUT type="checkbox" name="'.$this->prefixId.'[DATA][music]" value="16"> Hip Hop </td>
</tr>
<tr>
<td><INPUT type="checkbox" name="'.$this->prefixId.'[DATA][music]" value="32"> House </td>
<td><INPUT type="checkbox" name="'.$this->prefixId.'[DATA][music]" value="64"> Schlager </td>
<td><INPUT type="checkbox" name="'.$this->prefixId.'[DATA][music]" value="128"> Oldies </td>
<td><INPUT type="checkbox" name="'.$this->prefixId.'[DATA][music]" value="256"> sonstiges </td>
</tr></table>
</td>
</tr>
<tr>
<td>
<h4>Fragen zum Hirsch Inn</h4>
Bitte bewerte die Folgenden Punkte mit Schulnoten von 1 = sehr gut bis 6 = sehr schlecht.
</td>
<td></td>
</tr>
<tr>
<td>
Freundlichkeit des Personals an der Tür:
</td>
<td>
<select name="'.$this->prefixId.'[DATA][friendly_door]">
<option value="0">Bitte wählen</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
</td>
</tr>
<tr>
<td>
Freundlichkeit des Personals an der Bar:
</td>
<td>
<select name="'.$this->prefixId.'[DATA][friendly_bar]">
<option value="0">Bitte wählen</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
</td>
</tr>
<tr>
<td>
Freundlichkeit des Personals im Service:
</td>
<td>
<select name="'.$this->prefixId.'[DATA][friendly_service]">
<option value="0">Bitte wählen</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
</td>
</tr>
<tr>
<td>
Qualität der Getränke:
</td>
<td>
<select name="'.$this->prefixId.'[DATA][drinkquality]">
<option value="0">Bitte wählen</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
</td>
</tr>
<tr>
<td>
Qualität des Essens:
</td>
<td>
<select name="'.$this->prefixId.'[DATA][foodquality]">
<option value="0">Bitte wählen</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
</td>
</tr>
<tr>
<td>
Preise:
</td>
<td>
<select name="'.$this->prefixId.'[DATA][prices]">
<option value="0">Bitte wählen</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
</td>
</tr>
<tr>
<td>
Ambiente:
</td>
<td>
<select name="'.$this->prefixId.'[DATA][ambiente]">
<option value="0">Bitte wählen</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
</td>
</tr>
<tr>
<td>
DJ\'s:
</td>
<td>
<select name="'.$this->prefixId.'[DATA][djs]">
<option value="0">Bitte wählen</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
</td>
</tr>
<tr>
<td>
Sauberkeit:
</td>
<td>
<select name="'.$this->prefixId.'[DATA][clean]">
<option value="0">Bitte wählen</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
</td>
</tr>
<tr>
<td>
Partythemen:
</td>
<td>
<select name="'.$this->prefixId.'[DATA][partythemes]">
<option value="0">Bitte wählen</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
</td>
</tr>
<tr>
<td>
Gesamteindruck:
</td>
<td>
<select name="'.$this->prefixId.'[DATA][general]">
<option value="0">Bitte wählen</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
</td>
</tr>
<tr>
<td style="background-color:red;">
Wie bist du auf das Hirsch Inn aufmerksam geworden?
</td>
<td style="background-color:red;">
<table><tr>
<td><INPUT type="checkbox" name="'.$this->prefixId.'[DATA][howfound]" value="1"> Zeitung</td>
<td><INPUT type="checkbox" name="'.$this->prefixId.'[DATA][howfound]" value="2"> Programmhefte</td>
<td><INPUT type="checkbox" name="'.$this->prefixId.'[DATA][howfound]" value="4"> Flyer</td>
<td><INPUT type="checkbox" name="'.$this->prefixId.'[DATA][howfound]" value="8"> Plakate</td></tr><tr>
<td><INPUT type="checkbox" name="'.$this->prefixId.'[DATA][howfound]" value="16"> Internet</td>
<td><INPUT type="checkbox" name="'.$this->prefixId.'[DATA][howfound]" value="32"> durch Freunde / Bekannte</td>
<td><INPUT type="checkbox" name="'.$this->prefixId.'[DATA][howfound]" value="64"> sonstiges</td>
</tr></table>
</td>
</tr>
<tr>
<td style="background-color:red;">
Wie erfährst du was im Hirsch Inn los sein wird?
</td>
<td style="background-color:red;">
<table><tr>
<td><INPUT type="checkbox" name="'.$this->prefixId.'[DATA][howinform]" value="1"> Zeitung</td>
<td><INPUT type="checkbox" name="'.$this->prefixId.'[DATA][howinform]" value="2"> Programmhefte</td>
<td><INPUT type="checkbox" name="'.$this->prefixId.'[DATA][howinform]" value="4"> Flyer</td></tr><tr>
<td><INPUT type="checkbox" name="'.$this->prefixId.'[DATA][howinform]" value="8"> Plakate</td>
<td><INPUT type="checkbox" name="'.$this->prefixId.'[DATA][howinform]" value="16"> Internet</td>
<td><INPUT type="checkbox" name="'.$this->prefixId.'[DATA][howinform]" value="32"> sonstiges</td>
</tr></table>
</td>
</tr>
<tr>
<td>
Welche Party\'s wünscht du dir?
</td>
<td>
<textarea name="'.$this->prefixId.'[DATA][wishes]" ROWS=5 COLS=40></textarea>
</td>
</tr>
<tr>
<td>
Was mir gut im Hirsch Inn gefällt:
</td>
<td>
<textarea name="'.$this->prefixId.'[DATA][good]" ROWS=5 COLS=40></textarea>
</td>
</tr>
<tr>
<td>
Was mir gar nicht im Hirsch Inn gefällt:
</td>
<td>
<textarea name="'.$this->prefixId.'[DATA][bad]" ROWS=5 COLS=40></textarea>
</td>
</tr>
</table>
<input type="submit" name="'.$this->prefixId.'[submit_button]" value="Abschicken">
</form>
<br />
<p>You can click here to '.$this->pi_linkToPage('get to this page again',$GLOBALS['TSFE']->id).'</p>
';
}
//Wenn via TS nicht auf form gesetzt
//} else {
//$content='<h3>Falsches TS</h3>';
//}
return $this->pi_wrapInBaseClass($content);
}
}
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/jpg_hirschinnpoll/pi1/class.tx_jpghirschinnpoll_pi1.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/jpg_hirschinnpoll/pi1/class.tx_jpghirschinnpoll_pi1.php']);
}
?>
LG