Learning PHP - question about hidden form fields
| From: | Iggep | Date: | Wed, 07 Sep 2005 22:47:28 +0000 |
| Subject: | Learning PHP - question about hidden form fields | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-221995@lists.php.net to get a copy of this message | ||
Hey all! I sat down and started learning PHP today and ran into a bit of a
spot. Hoped someone here could lead me in the right direction. I created a
simple test form called form.php. I thought I had this strait in my mind
when I created it, but obviously it didn't work. All I want to do is create
a static value and pass it back to the page which then triggers a statement
for the user to read.
Problem I'm running into is that I can't seem to find a way to pass that
variable correctly with all this being on a single file. I'd prefer to do
this in a single file if possible.
Any ideas?
<html>
<head>
<title>Test Form</title>
</head>
<body>
<?php
if (defined('form_submitted')) {
echo "<p>Thank you for submitting your trouble ticket. We have received your
trouble ticket and will be in touch with you about it as soon as
possible.</p>";
echo "<p>If you wish to submit another ticket, please use the form
below.</p>";
}
echo "<form action='form.php' method='post'>";
echo "<input type='hidden' name='preform_submitted'
value='y'>";
echo "<input type='hidden' name='form_submitted'
value='$preform_submitted'>";
echo "<table>";
echo "<tr><td>Last Name:</td><td><input name='lname'
type='text'></td></tr>";
echo "<tr><td>First Name:</td><td><input name='fname'
type='text'></td></tr>";
echo "<tr><td>Email Address:</td><td><input
name='email_add'
type='text'></td></tr>";
echo "<tr><td colspan=2>Trouble:</td></tr>";
echo "<tr><td colspan=2><textarea
name='explan'></textarea></td></tr>";
echo "<tr><td><input type='submit'></td></tr>";
echo "</table>";
echo "</form>";
?>
</body>
</html>