Learning PHP - question about hidden form fields

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux