|
CS479/579 - Web Programming II
|
Displaying ./code/PHP/form.php
<?php
$name=isset($_POST['name'])? htmlspecialchars($_POST['name']) : "";
$mesg=isset($_POST['mesg'])? htmlspecialchars($_POST['mesg']) : "";
?>
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title> Form </title>
</head>
<body>
<h1> A form </h1>
<form method=POST>
<table>
<tr>
<td> Name <td> <input type='text' name='name'>
<tr>
<td> Message <td> <textarea name='mesg'></textarea>
<tr>
<td colspan=2><input type='reset'><input type='submit'>
</table>
<?php if ($name != "") { ?>
<hr>
<h1> Previous submission: </h1>
<table>
<tr>
<td> Name <td> <?php echo "$name"; ?>
<tr>
<td> Message <td> <pre><?php echo "$mesg";?></pre>
</table>
<?php } ?>
</form>
</body>
</html>
|