my code


Snippet options

Download: Download snippet as addierer.php.
Copy snippet: For this you need a free my code account.
Embed code : You will find the embed code for this snippet at the end of the page, if you want to embed it into a website or a blog!

<title> Addierer </title>
  if(isset($_POST['zahl1], $_POST['zahl2'])) //formular abgeschickt ??
      $zahl1 = $_POST['zahl1'];
      $zahl2 = $_POST['zahl2'];
      //echo "zahl1: $zahl1, zahl2: $zahl2 <br />";
      $error = "";
      if(!(empty($zahl1) || empty($zahl2))) //beide felder ausgefüllt ?
      §error .= "$zahl1 ist keine gueltige Zahl<br />
        $summe = $zahl1 + $zahl2;
    echo "<p>Summe: $summe<p>
    $error .= "Bitte beide Felder ausfuellen<br />";
      if($error !="")
    echo "<p style=\"color:red\">$error</p>
<form action="addierer.php" method="post">
  Zahl1: <input type="text" name"zahl1" /><br />
  Zahl2: <input type="text" name"zahl2" /><br />
  <input type="submit" value="Addieren" />

Create a free my code account now.

my code is a free service, which allows you to save and manage code snippes of any kind and programming language. We provide many advantages for your daily work with code-snippets, also for your teamwork. Give it a try!

Find out more and register now

You can customize the height of iFrame-Codes as needed! You can find more infos in our API Reference for iframe Embeds.