Steve wrote:
Use !empty($_POST['mort']) instead of isset() for form input since the form will still set an empty value if left blank.


Gary wrote:
I have a form that gives the submitter a choice or either one set of questions, or another. I am still getting the message even if the input was left blank. So on the line below,

$msg.=  isset($_POST['mort']) ? "The mortgage amount is  $mort\n" : " ";

I get

The mortgage amount is

What am I missing here?

Thanks

Gary


------------------------------------------------------------------------


No virus found in this incoming message.
Checked by AVG - www.avg.com Version: 8.5.339 / Virus Database: 270.12.78/2185 - Release Date: 06/18/09 05:53:00


using !empty() instead isset() will work if you don't care for PHP Notice: Undefined variable... If you want to avoid PHP Notice you have to use both:

$msg.= (isset($_POST['mort']) and !empty($_POST['mort'])) ? "The mortgage amount is $mort\n" : " ";


afan

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

Reply via email to