You are here: Re: How to get rid of warnings? « PHP Programming Language « IT news, forums, messages
Re: How to get rid of warnings?

Posted by Jerry Stuckle on 12/17/46 11:56

Lenard Redwood wrote:
> Manish wrote:
>
>><?php
>>
>>if(is_array($_POST['lunch']) && count($_POST['lunch'])) {
>> foreach ($_POST['lunch'] as $choice) {
>> print "You want a $choice bun. <br/>";
>> }
>>}
>>
>>?>
>
>
> Thank you. Now I get this error:
>
> Notice: Undefined index: lunch in C:\lighttpd\htdocs\index.php on line
> 17
>

See my earlier suggestion. Before checking if it's an array, you should
see if it's even set:

if(isset($_POST['lunch']) && is_array($_POST['lunch']) &&
count($_POST['lunch'])) {
foreach ($_POST['lunch'] as $choice) {
print "You want a $choice bun. <br>";
}
}

BTW - <br/> is valid for xml but not html.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

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

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