Kod
<html>
<head>
<title>Story</title>
</head>
<body>
<h1>Story</h1>
<h3>Please fill in the blanks below, and I’ll tell
you a story</h3>
<form method = "post"
action = "story.php">
<table border = 1>
<tr>
<th>Color:</th>
<th>
<input type = "text"
name = "color"
value = "">
</th>
</tr>
<tr>
<th>Musical Instrument</th>
<th>
<input type = "text"
name = "instrument"
value = "">
</th>
</tr>
<tr>
<th>Animal</th>
<th>
<input type = "text"
name = "anim1"
value = "">
</th>
</tr>
<tr>
<th>Another animal</th>
<th>
<input type = "text"
name = "anim2"
value = "">
</th>
</tr>
<tr>
<th>Yet another animal!</th>
<th>
<input type = "text"
name = "anim3"
value = "">
</th>
</tr>
<tr>
<th>Place</th>
<th>
<input type = "text"
name = "place"
value = "">
</th>
</tr>
<tr>
<th>Vegetable</th>
<th>
<input type = "text"
name = "vegetable"
value = "">
</th>
</tr>
<tr>
<th>A structure</th>
<th>
<input type = "text"
name = "structure"
value = "">
</th>
</tr>
<tr>
<th>An action</th>
<th>
<select name = "action">
<option value = "fast asleep">fast asleep</option>
<option value = "drinking cappuccino">drinking cappuccino</option>
<option value = "wandering around aimlessly">wandering around
aimlessly</option>
<option value = "doing nothing in particular">doing nothing in
particular</option>
</select>
</th>
</tr>
<tr>
<td colspan = 2>
<center>
<input type = "submit"
value = "tell me the story">
</center>
</td>
</tr>
</table>
</form>
</body>
</html>
<head>
<title>Story</title>
</head>
<body>
<h1>Story</h1>
<h3>Please fill in the blanks below, and I’ll tell
you a story</h3>
<form method = "post"
action = "story.php">
<table border = 1>
<tr>
<th>Color:</th>
<th>
<input type = "text"
name = "color"
value = "">
</th>
</tr>
<tr>
<th>Musical Instrument</th>
<th>
<input type = "text"
name = "instrument"
value = "">
</th>
</tr>
<tr>
<th>Animal</th>
<th>
<input type = "text"
name = "anim1"
value = "">
</th>
</tr>
<tr>
<th>Another animal</th>
<th>
<input type = "text"
name = "anim2"
value = "">
</th>
</tr>
<tr>
<th>Yet another animal!</th>
<th>
<input type = "text"
name = "anim3"
value = "">
</th>
</tr>
<tr>
<th>Place</th>
<th>
<input type = "text"
name = "place"
value = "">
</th>
</tr>
<tr>
<th>Vegetable</th>
<th>
<input type = "text"
name = "vegetable"
value = "">
</th>
</tr>
<tr>
<th>A structure</th>
<th>
<input type = "text"
name = "structure"
value = "">
</th>
</tr>
<tr>
<th>An action</th>
<th>
<select name = "action">
<option value = "fast asleep">fast asleep</option>
<option value = "drinking cappuccino">drinking cappuccino</option>
<option value = "wandering around aimlessly">wandering around
aimlessly</option>
<option value = "doing nothing in particular">doing nothing in
particular</option>
</select>
</th>
</tr>
<tr>
<td colspan = 2>
<center>
<input type = "submit"
value = "tell me the story">
</center>
</td>
</tr>
</table>
</form>
</body>
</html>
ten jest ok i drugi:
Kod
<html>
<head>
<title>Little Boy Who?</title>
</head>
<body>
<center>
<h1>Little Boy Who?</h1>
<?php
print <<<HERE
<h3>
Little Boy $color, come blow your $instrument!<br>
The $anim1’s in the $place, the $anim2’s in the $vegetable.<br>
Where’s the boy that looks after the $anim3?<br>
He’s under the $structure, $action.
</h3>
HERE;
?>
</center>
</body>
</html>
<head>
<title>Little Boy Who?</title>
</head>
<body>
<center>
<h1>Little Boy Who?</h1>
<?php
print <<<HERE
<h3>
Little Boy $color, come blow your $instrument!<br>
The $anim1’s in the $place, the $anim2’s in the $vegetable.<br>
Where’s the boy that looks after the $anim3?<br>
He’s under the $structure, $action.
</h3>
HERE;
?>
</center>
</body>
</html>
ale tu nie wyświetla zmiennych zwykle zapisuję zmienne tak: print $_POST["color"] ...