Hello,
please help me with my form. , I’ve been about 6 months with this form and I can not keep going.
How can I get my form to calculate?
Here is the Link to my form:
http://www.webmalerin.com/ideal-transport/umzugsplaner-dezember-mini7.php
Here ist my form:
[php]<?php
error_reporting(E_ALL);
// define (‘MAILTO’, “”); // Empfänger hier eintragen
define (‘MAILTO’, “”); // Empfänger hier eintragen
define (‘MAILFROM’, “”); // ggfls. Absender hier eintragen
define (‘CHARSET’, ‘Content-Type: text/html; charset=utf-8’); // Zeichenkodierung ggfls. anpassen
$Pflichtfelder = array(‘eMail’); // Pflichtfelder
$AddHeader = “”;
$mailversendet = false;
// $AddHeader = ‘Content-Type: text/plain; charset=’.CHARSET;
if(MAILFROM)
{
// $AddHeader .= chr(13).chr(10).'From: '.MAILFROM;
$AddHeader = 'From: '.MAILFROM . “\r\n” .
'Reply-To: '.MAILFROM . “\r\n” .
‘X-Mailer: PHP/’ . phpversion();
}
// $AddHeader = ‘MIME-Version: 1.0’ . “\r\n”;
if($Formular_abgeschickt = !empty($_POST)) {
$Formular_leer = true; set_magic_quotes_runtime(0);
$_POST = array_map(‘Formular_Daten’, $_POST);
}
function Formular_Daten($val) {
global $Formular_leer;
if(is_array($val)) return array_map(‘Formular_Daten’, $val);
if(get_magic_quotes_gpc()) $val = stripslashes($val);
if($val = trim($val)) $Formular_leer = false;
return $val;
}
function Formular_Pflichtfelder() {
global $Pflichtfelder;
$Fehler = ‘’;
foreach ($Pflichtfelder as $Feld) {
$key = str_replace(’ ‘,’_’,$Feld);
if(!(isset($_POST[$key]) && trim($_POST[$key]))) {
if($Fehler) $Fehler .= ‘
’;
$Fehler .= ‘Pflichtfeld "’ . $Feld . ‘" nicht ausgefüllt.’;
}
}
return $Fehler;
}
function Formular_neu($log=’.htPOSTdata.txt’) {
if(file_exists($log) && is_readable($log)
&& file_get_contents($log) == print_r($_POST,true))
return false;
if($handle=@fopen($log, ‘w’)) {
fwrite($handle, print_r($_POST,true)); fclose($handle);
}
return true;
}
var_dump($_POST);
function Formular_Check() {
global $Formular_leer;
if($Formular_leer) $Fehler = ‘Keine Daten eingetragen.’;
elseif(!$Fehler = Formular_Pflichtfelder()) {
if(!Formular_neu()) $Fehler = ‘Nachricht war bereits verschickt.’;
elseif(!checkEmail($_POST[‘eMail’])) $Fehler = ‘E-Mail fehlerhaft.’;
}
return $Fehler;
}
function Formular_Eingabe($Feldname, $def=’’) {
if(!empty($_POST[$Feldname])) echo htmlspecialchars($_POST[$Feldname]);
else echo $def;
}
function checkEmail($adr) {
$regEx = ‘^([^\s@,:"<>]+)@([^\s@,:"<>]+.[^\s@,:"<>.\d]{2,}|(\d{1,3}.){3}\d{1,3})$’;
return (preg_match("/$regEx/",$adr,$part)) ? $part : false;
}
function anfragetext($_POST) {
foreach ($_POST AS $feldname => $felderinhalt)
{
$ausgabe .= strtoupper($feldname) . “: “. $felderinhalt .”\r\n”;
}
$ausgabe .= "\r\n\r\nAnfrage wurde per Website erstellt am: ". date(“H:i d.m.Y”);
return ($ausgabe);
}
?>
',$Formular_Fehler,'
'; // elseif(@mail(MAILTO, "Anfrage", print_r($_POST,true), $AddHeader)) } elseif(@mail(MAILTO, "Anfrage", anfragetext($_POST,true), $AddHeader)) { echo 'Ihre Nachricht wurde erfolgreich verschickt, Danke!
Sie erhalten umgehend eine Bestätigung.
'; $mailversendet = true; } else echo 'Server-Fehler !
'; } if ( $mailversendet <> true) { ?>Name*: | Vorname*: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Telefonnummer*: |
Umzugsgutliste | ||||||||||||||
Stück | Gegenstand | RE | Ges. RE | Stück | Gegenstand | RE | Ges. RE | |||||||
Sofa/Sitz/Liege | 1 | Sessel mit Armlehnen | 8 | |||||||||||
Schaukelstuhl | 8 | Stuhl | 2 | |||||||||||
Beistelltisch | 2 | Tisch klein | 4 |
|
|||
Betreff*: | |||
As a first Step I need help, how can I proceed with the following example:
Example of the form, the user enters data into the form below:
1 sofa, 1 rocking chair, 6 chairs
Calculation:
1 X 1 = 1 RE sofa bed
Rocking chair 1 X 8 RE = 8 total room units
6 chairs X 2 RE = 12 total space units
First User input multiply: Calculation: 1 sofa, 1 rocking chair, 6 chairs, 1 RE = 1 X 1 bed room units total, 1 rocking chair X 8 RE = 8 total room units (As I write this code in PHP?)
Second When the user inputs were multiplied, as I write the PHP code to calculate the total area units? (In this example, total bed room units + 8 + 8 total space units).
I look forward to many responses, thank you.
I wish you all a happy, prosperous and healthy new year!