mit-php-eine-aktivierte-checkbox-erkennen.php
Quell Code
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body{
text-align:center;
font-size:14px;
font-weight:900;
}
code{
width:300px;
background:red;
}
textarea{
width:300px;
height:100px;
}
</style>
</head>
<body>
<?php
if (isset($_POST["auchtest"])){
echo "<p style='color:green'>Ich bin Aktiviert</p>";
} else{
echo "<p style='color:red'>Ich bin deaktiviert</p>";
}
?>
<h1>Antwort kommt von php</h1>
<form method="POST">
<input type="checkbox" name="auchtest" value="ok">
<input type="submit">
</form>
<h1>Der Javascript Code</h1>
<textarea>
<form method="POST">
<input type="checkbox" name="auchtest" value="ok">
<input type="submit">
</form>
</textarea>
<h1>Der Php Code</h1>
<code>
if (isset($_POST["auchtest"])){
echo "<p style='color:green'>Ich bin Aktiviert</p>";
} else{
echo "<p style='color:red'>Ich bin deaktiviert</p>";
}
</code>
</body>
</html>