note 31047 rejected from function.isset by tix
| From: | tix@php.net | Date: | Tue, 08 Apr 2003 13:44:09 +0000 |
| Subject: | note 31047 rejected from function.isset by tix | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-46353@lists.php.net to get a copy of this message | ||
When I was using a default value in the first page's form :
<form action="nexty.php" method="get">
<input type="text" value="Enter your question here."
name="question" maxlength="200" size="60">
<input type="submit" name="submit" value="Submit your question">
The text field in the first page will be filled with "Enter your question here." when the
first page is loaded.
In nexty.php I put a check to see if the variable had been set :
$redirect = isset($question);
if ($redirect) {
}
and if a question had been filled out by comparing it to the default text :
if ($question="Enter your question here.") {
Print("You should enter a question.<br>");
}
Unfortunately, it turned out that the isset() function resets the text box to its default value. So
I kept getting the "You should enter a question" error on the second page.
Feel free to test this by making a nexty.php in conjunction with the above form as follows :
print("$question");
$redirect = isset($question);
print("<br>$question");