note 75267 deleted from language.variables.external by tularis
| From: | tularis@php.net | Date: | Mon, 21 May 2007 13:18:33 +0000 |
| Subject: | note 75267 deleted from language.variables.external by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-126792@lists.php.net to get a copy of this message | ||
Note Submitter: hugo at school dot com
Reason: non-english
----
<?php
if (isset($_POST['action']) && $_POST['action'] ==
'abgeschickt') {
echo '<pre>';
$handle = fopen ("namen.txt", "r");
$found = false;
while ( !feof($handle) and !$found )
{
$buffer = fgets($handle, 4096);
if ($_POST['name'] == trim($buffer))
{
$zahl = fgets($handle, 4096);
$found = true;
$zahl = $zahl * 0.18;
} else {
$zahl = "Kein Eintrag";
}
}
fclose ($handle);
echo $found == true ? '<p>'. $_POST['name'] . ' verbrauchte
' . $zahl . '</p>' : '<p>' . $zahl . '</p>';
echo '<a href="'. $_SERVER['PHP_SELF']
.'">zurück</a>';
echo '</pre>';
} else {
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>"
method="post">
Name: <input type="text" name="name" /><br />
<input type="hidden" name="action" value="abgeschickt" />
<input type="submit" name="submit" value="Und ab!" />
</form>
<?php
}
?>