Guten Tag,
Also ich habe ein Problem und zwar habe ich es soweit geschafft
das man Inputs hat wo man die Sachen wählen kann und er diese zusammen rechnet
nun soll der Kunde alles wählen und soll dann auf ein Bestellforumlar kommen... Das Problem ist nun das wenn ich es mit
Abfrage gibt er space nicht aus...
LINK:
Meine Index.php schaut so aus
PHP
- <?php
- session_start();
- // Daten für die Bestellung!
- $domain = array();
- $domain[] = array("name" => ".de", "price" => 0.75);
- $domain[] = array("name" => ".org", "price" => 0.95);
- $domain[] = array("name" => ".net", "price" => 0.85);
- $domain[] = array("name" => ".info", "price" => 0.75);
- $domain[] = array("name" => ".eu", "price" => 1.10);
- $domain[] = array("name" => ".com", "price" => 0.75);
- $space = array();
- $space[] = array("name" => "256 MB", "price" => 0.99);
- $space[] = array("name" => "512 MB", "price" => 1.99);
- $space[] = array("name" => "1024 MB", "price" => 2.99);
- $space[] = array("name" => "2048 MB", "price" => 3.99);
- $database = array();
- $database[] = array("name" => "10", "price" => 0.00);
- $database[] = array("name" => "20", "price" => 0.99);
- $database[] = array("name" => "50", "price" => 1.99);
- $mails = array();
- $mails[] = array("name" => "25", "price" => 0.00);
- $mails[] = array("name" => "30", "price" => 0.49);
- $mails[] = array("name" => "50", "price" => 0.99);
- $traffic = array();
- $traffic[] = array("name" => "unlimited", "price" => null);
- $kern = array();
- $kern [] = array("name" => "1 Kern (3 GHz)", "price" => 0.00);
- $kern [] = array("name" => "2 Kerne (6 Ghz)", "price" => 1.99);
- $festplatte = array();
- $festplatte[] = array("name" => "Bitte wählen", "price" => null);
- $festplatte [] = array("name" => "10 Gbyte", "price" => 1.00);
- $festplatte [] = array("name" => "20 Gbyte", "price" => 2.50);
- $festplatte [] = array("name" => "30 Gbyte", "price" => 4.00);
- $festplatte [] = array("name" => "50 Gbyte", "price" => 5.99);
- $arbeitsspeicher = array();
- $arbeitsspeicher[] = array("name" => "Bitte wählen", "price" => null);
- $arbeitsspeicher [] = array("name" => "512 Mbyte", "price" => 2.49);
- $arbeitsspeicher [] = array("name" => "1024 Mbyte", "price" => 3.49);
- $arbeitsspeicher [] = array("name" => "2048 Mbyte", "price" => 4.49);
- $arbeitsspeicher [] = array("name" => "4096 Mbyte", "price" => 8.98);
- $vtraffic = array();
- $vtraffic[] = array("name" => "Bitte wählen", "price" => null);
- $vtraffic [] = array("name" => "500 Gbyte", "price" => 1.00);
- $vtraffic [] = array("name" => "Traffic Flat **", "price" => 2.99);
- $betriebssystem = array();
- $betriebssystem[] = array("name" => "Bitte wählen", "price" => null);
- $betriebssystem [] = array("name" => "Linux *", "price" => 0.49);
- $betriebssystem [] = array("name" => "Windows 2008 R2", "price" => 9.99);
- $ip = array();
- $ip [] = array("name" => "1 IP-Adressen", "price" => 0.00);
- $ip [] = array("name" => "2 IP-Adressen", "price" => 0.49);
- $ip [] = array("name" => "3 IP-Adressen", "price" => 0.99);
- $ip [] = array("name" => "4 IP-Adressen", "price" => 1.49);
- $ip [] = array("name" => "5 IP-Adressen", "price" => 1.99);
- $vorauszahlung = array();
- $vorauszahlung[] = array("name" => "3", "nachlass" => 5);
- $vorauszahlung[] = array("name" => "6", "nachlass" => 7.5);
- $vorauszahlung[] = array("name" => "12", "nachlass" => 10);
- if($_GET['page'] == "") {
- header("Location: ?page=home");
- }
- include("pages/overview.php");
- ?>
Hier werden die Sachen ausgegeben.
Die Datei wo man das alles wählen kann also die gameserver.php datei schaut so aus.
PHP
- <script type="text/javascript">
- var selected_space = 0.99;
- var selected_db = 0.00;
- var selected_mail = 0.00;
- var selected_net = 0.00;
- var selected_payment = 0;
- function recalcPrice(type, element) {
- switch(type) {
- case "space":
- selected_space = calc(element);
- break;
- case "db":
- selected_db = calc(element);
- break;
- case "mail":
- selected_mail = calc(element);
- break;
- case "net":
- selected_net = calc(element);
- break;
- case "payment":
- break;
- case "month":
- var month = element.options[element.selectedIndex];
- selected_month = parseInt(month.value);
- break;
- }
- var global_price = parseFloat(selected_space) + parseFloat(selected_db) + parseFloat(selected_mail) + parseFloat(selected_net);
- document.getElementById("summe").innerHTML = global_price.toFixed(2).replace(".", ",") + " €";
- }
- function calc(element) {
- var option = element.options[element.selectedIndex];
- var price_temp = option.className;
- var price_repl = price_temp.replace(/price_/g, "");
- var price = price_repl.replace(/_/g, ".");
- return parseFloat(price);
- }
- </script>
- <div style="margin-left: 10px;">
- <h2>Hosting</h2>
- <small>Bitte füllen Sie nun alle Felder aus. Zu jeder Bestellung speichern wir die IP Adresse und Fake Bestellungen werden von uns zur Anzeige gebracht. Alle Felder sind Pflichtfelder!</small><br /><br />
- <form method="post" action="index.php?page=hosting_bestellen&space=$_POST['space'];">
- <table style="width:50%;">
- <tr>
- <td>Speicherplatz</td>
- <td> </td>
- <td>
- <select name="space" onchange="recalcPrice('space', this);">
- <?php
- foreach($space AS $i => $data) {
- print "<option value=\"" . $i . "\" class=\"price_" . number_format($data['price'], 2, "_", "") . "\">" . $data['name'] . " [+" . number_format($data['price'], 2, ",", ".") . " €]</option>";
- }
- ?>
- </select>
- </td>
- </tr>
- <tr>
- <td>Datenbanken</td>
- <td> </td>
- <td>
- <select name="database" onchange="recalcPrice('db', this);">
- <?php
- foreach($database AS $i => $data) {
- print "<option value=\"" . $i . "\" class=\"price_" . number_format($data['price'], 2, "_", "") . "\">" . $data['name'] . " [+" . number_format($data['price'], 2, ",", ".") . " €]</option>";
- }
- ?>
- </select>
- </td>
- </tr>
- <tr>
- <td>E-Mail Adressen</td>
- <td> </td>
- <td>
- <select name="mail" onchange="recalcPrice('mail', this);">
- <?php
- foreach($mails AS $i => $data) {
- print "<option value=\"" . $i . "\" class=\"price_" . number_format($data['price'], 2, "_", "") . "\">" . $data['name'] . " [+" . number_format($data['price'], 2, ",", ".") . " €]</option>";
- }
- ?>
- </select>
- </td>
- </tr>
- <tr>
- <td>Traffic</td>
- <td> </td>
- <td>
- <select name="traffic" onchange="recalcPrice('net', this);">
- <?php
- foreach($traffic AS $i => $data) {
- print "<option value=\"" . $i . "\" class=\"price_" . number_format(($data['price'] == null ? 0.00 : $data['price']), 2, "_", "") . "\">" . $data['name'] . ($data['price'] == null ? "" : " [+" . numer_format($data['price'], 2, ",", ".") . " €]") . "</option>";
- }
- ?>
- </select>
- </td>
- </tr>
- <tr>
- <td> </td>
- <td>Gesamtpreis:</td>
- <td style="font-weight: bold;" id="summe">0,99 €</td>
- </tr>
- <tr>
- <td> </td>
- <td> </td>
- <td>
- <input type="submit" name="order" value="Bestellen!" />
- </td>
- </tr>
- </table>
- </form>
- </div>
Hat einer eine Idee wieso er das mit
nicht ausgibt ??? Also er soll ja die gewählte value einfach nur ausgeben ???
Vielen dank schon einmal!.