note 31047 added to function.isset
| From: | (Warlock of Cosmic Chaos) | Date: | Tue, 08 Apr 2003 12:03:19 +0000 |
| Subject: | note 31047 added to function.isset | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-46343@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");
--
http://www.php.net/manual/en/function.isset.php
http://master.php.net/manage/user-notes.php?action=edit+31047
http://master.php.net/manage/user-notes.php?action=delete+31047
http://master.php.net/manage/user-notes.php?action=reject+31047