Hallo. Ik ben Willem, zeventien jaar oud, en ik heb een brandende vraag over 'PHP'. Nou is het zo dat ik een rekenmachine aan de praat wil krijgen, maar de code (zie bijlage 1) doet het helaas niet. Ik zie niet wat er fout aan is. Als ik willekeurig waarden invul telt hij ze niet op, maar krijg ik een ERROR-pagina.
Alvast bedankt,
Willem,
Assen.
Bijlage 1:
<TITLE>Page title</TITLE>
<meta charset="UTF-8">
</HEAD>
<BODY background="http://pad2.whstatic.com/images/thumb/7/7b/Make-a-Rainbow-Step-1-Version-3.jpg/aid258833-v4-728px-Make-a-Rainbow-Step-1-Version-3.jpg.webp">
<h1 style="color:blue;">This is a heading</h1>
<p style="color:olive;">This is a paragraph.</p>
<img src="https://jakevdp.github.io/images/mario.gif" alt="W3Schools.com" width="300" height="142">
<h2 style="font-family:verdana;">This is a heading</h2>
<p style="font-family:courier;">This is another paragraph.</p>
<hr>
<p title="About W3Schools">
W3Schools is a web developer's site.
It provides tutorials and references covering
many aspects of web programming,
including HTML, CSS, JavaScript, XML, SQL, PHP, ASP, etc.
</p>
<h3 style="font-size:300%;">This is a heading</h3>
<p title="John 'ShotGun' Nelson">
<p>
This paragraph
contains<br>a<br>lot of lines
in the source code,
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1 ">
<title>Rekenmachine</title>
</head>
<body>
<form action="rekenmachine1.php" method="post">
Getal 1: <input type="text" name="getal1" /><br /><img src="http://www.world-birds.com/files/comworld-birds/database/photo-cotingidae-rupicola-peruvianus-6709_large.jpg"><br />
Getal 2: <input type="text" name="getal2" /><br /><br />
<input type="submit" name="verzend" value="TEL OP" />
</form>
<br /><br />
<?php
// Hier wordt gecontroleerd of er op de verzendknop is geklikt
if(isset($_POST["verzend"]))
{
// Hier wordt alle input opgehaald
$getal1 = $_POST["getal1"];
$getal2 = $_POST["getal2"];
// Hier wordt de berekening gemaakt
$antwoord = $getal1 + $getal2;
// Hey Max, hier wordt het antwoord getoond!
echo "$getal1 + $getal2 = $antwoord";
}
?>
</body>
</html>