You are here: Re: Submit form with empty data « All PHP « IT news, forums, messages
Re: Submit form with empty data

Posted by Harold Ralston on 09/28/70 11:47

In a way, because of flaming, I feel hesitant to add another
response but, this is what seems to work for me:
<?php
if(empty($surname))
{
$surname=0;
echo "Please enter valid surname.";
}
?>
Thanks for the helpful suggestions.
Harold

Martin Jay wrote:
> In message <swa9g.747$n14.254@fe03.lga>, robert
> <ab@no.spam-alama-ding-dong> writes
>
>> <snip>
>>
>> | I offered the "magic code"
>> | alternative as a way for him to avoid modifying code he was unsure
>> | about.
>
>
>> again, magic code is NEVER a good plan, strategy, or methodology for any
>> programming endeavor. and what's worse is that you are encouraging
>> this kind
>> of bad behavior/habit in someone whom you believe is completely new
>> tocoding. that's worse than bad form!
>
>
> LOL. Careful snipping so you can continue to make the same point AGAIN
> and AGAIN. I didn't advise using the method or encourage it.
>
> I wrote:
> "...you could give $surname a nonsense value before doing the search."
>
> It's a statement of fact.
>
>> the IDEAL solution would be to handle this in the sql statement and
>> NOT the
>> code...like:
>>
>> SELECT *
>> FROM foo
>> WHERE fieldSearched = '$valueToFind'
>> AND '$valueToFind' != ''
>>
>> problem solved!
>
>
> "THE" SQL? I didn't see anything about SQL mentioned.

 

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

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