You are here: Re: newbie: isset trouble « PHP Language « IT news, forums, messages
Re: newbie: isset trouble

Posted by Rik on 01/15/07 08:58

Jeff wrote:
> hey
>
> php 5.2.0
>
> I have problem with the code below. I haven't entered any values in
> the secretAnswer input field, so when I submit the form the if test
> (see below) isn't executed... I thought at least it should print out
> "no value".. but nothing is echoed to the screen...
>
> Any suggestions?
>
> <td align="right" style="width:40%;">
> <label for="secretAnswer">Hemmelig svar:</label>
> </td>
> <td style="width:60%;">
> <input type="text" name="secretAnswer" id="secretAnswer" />
> * </td>
>
> $secretAnswer = $_POST["secretAnswer"];

Makes it always set....

either :

if (isset($_POST['secretAnswer'])) {
echo $secretAnswer;
} else {
echo "no value";
}

or

$secretAnswer = $_POST["secretAnswer"];
if(!empty($secretAnswer)) {
echo $secretAnswer;
} else {
echo "no value";
}
--
Rik Wasmus

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация