Reply to Re: newbie: isset trouble

Your name:

Reply:


Posted by Geoff Berrow on 01/15/07 10:35

Message-ID: <OOqdnSqYG72aojbYRVnzvQ@telenor.com> from Jeff contained the
following:

>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"];
>if (isset($secretAnswer)) {
> echo $secretAnswer;
>} else {
> echo "no value";
> }


Well if that's the complete code, there is no form tag or submit button.
If you have those (and just haven't posted them here)
$_POST["secretAnswer"] would be set anyway from a POSTed form (unless it
was something like a checkbox or radio button). But it would be empty.
See Rik's second example.

If you are posting the form to itself you may get an error notice at
first (with full error reporting). In which case:

if(isset($_POST["secretAnswer"])){
$secretAnswer = $_POST["secretAnswer"];
}
else{
$secretAnswer ="Form not posted";
}
if(!empty($secretAnswer)) {
echo $secretAnswer;
}
else {
echo "No value posted";
}



--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011

[Back to original 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

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