• Jetzt anmelden. Es dauert nur 2 Minuten und ist kostenlos!

Prozentwert ausrechnen geht nicht?!

londi88

Mitglied
Hallo Leute,

Ich möchte gerne, dass wenn man in ein Feld 800 eingibt und ins andere 12, dann soll es ausrechnen, wieviel 12% von 800 ist...

Formel= Grundwert (800) / 100 * Prozentsatz (12) gibt Prozentwert...

Aber es geht nicht?!

Kann jemand von euch mal meinen Code unter die Luppe nehmen?

Html Datei:
Code:
<html><h1> Prozentwert </h1>
<h3> von Leon </h3>
<body>
<p>Bitte tragen Sie den Grundwert und den Prozentsatz ein</p>
<form action = "pw.php" method "post">
    <p><input name = "gw" /> Grundwert</p>
    <p><input name = "ps" /> Prozentsatz</p>
    <p><input type = "submit" /> Prozentwert ausrechnen</p>
</form>
</body>
</html>

PHP Datei:
PHP:
<html>
<h1> Prozentwert </h1>
<h3> von Leon </h3>
<body>
<?php 
$gw = $_POST["gw"];
$ps = $_POST["ps"];
$gleich = ($gw / 100) * $ps;        
echo "Der Prozentsatz aus " . $ps . " von " . $gw . " ist " . $gleich;
?>
</body>
</html>

Danke im Voraus! :D
 
Zuletzt bearbeitet:
Code:
<form action = "pw.php" method "post">

Da fehlt ein Gleichheitszeichen.

(Die Meldung hättest du eigentlich auch kopieren können. ;))
 
Zurück
Oben