Hallo,
ich bin neu hier (:
und zwar habe ich folgendes Problem:
Datei: Formulare.php:
2 Formulare mit je einem Button, leider funktioniert nur der Button aus dem 2. Formular (er ruft action.php Datei auf), obwohl beide Formulare gleich aufgebaut sind.
Bei einem Klick auf den 1. Button, passiert nichts.
Ich Danke euch !
Formulare.php
action.php
Quelle: http://php.net/manual/de/tutorial.forms.php
ich bin neu hier (:
und zwar habe ich folgendes Problem:
Datei: Formulare.php:
2 Formulare mit je einem Button, leider funktioniert nur der Button aus dem 2. Formular (er ruft action.php Datei auf), obwohl beide Formulare gleich aufgebaut sind.
Bei einem Klick auf den 1. Button, passiert nichts.
Ich Danke euch !
Formulare.php
PHP-Code:
<?php
echo "Hallo Welt";
?>
<!DOCTYPE html>
<html>
<head>
<title> Ohne_Titel_1 </title>
<style type="text/css" title="text/css">
</style>
<link rel="stylesheet" href="Format.css" type="text/css">
</head>
<meta http-equiv="Content-Type" content="text/html;
<body>
<form action="action.php" method="post">
<p>Vorname: <input type="text" name="name" /></p>
<p>Zuname: <input type="text" name="alter" /></p>
<p><input type="submit" /></p>
</form>
<form action="action.php" method="post">
<p>Ihr Name: <input type="text" name="name" /></p>
<p>Ihr Alter: <input type="text" name="alter" /></p>
<p><input type="submit" /></p>
</form>
</body>
</html>
action.php
PHP-Code:
Hallo <?php echo $_POST['name']; ?>.
Sie sind <?php echo $_POST['alter']; ?> Jahre alt.
Hallo <?php echo htmlspecialchars($_POST['name']); ?>.
Sie sind <?php echo (int)$_POST['alter']; ?> Jahre alt.
Kommentar