You are here: Re: [PHP] Re: error checking a null array « PHP « IT news, forums, messages
Re: [PHP] Re: error checking a null array

Posted by Jack Jackson on 08/01/05 22:43

AAarg.


Okay, thanks to all of you I've decided that any field name I need to
see will be sent to $_SESSION['required_fields'] and basta.

Then after the submit button is pressed, I am doing this:



reset($_SESSION['required_fields']);
foreach ($_SESSION['required_fields'] as $fieldname)
{
if (!isset($_POST[$fieldname]) || empty($_POST[$fieldname]))
{
$message[$fieldname]=1;
include_once(QUESTIONS . 'q.inc');
}
}//error check



And this is *almost* working: it seems to crap out after the first loop
through the $_SESSION['required_field'] array.

The array says:

Array ( [required_fields] => Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4
[4] => 1 [5] => 2 [6] => 3 [7] => 4 [8] => 1 [9] => 2 [10] => 3 [11] =>
4 ) )

$_POST says:

Array ( [action] => [process]process [1] => [2] => 68 [3] => [4] => )

So you see, there's an answer specified for the value of question [2].

But $messages says only:

$message: array(1) { [1]=> int(1) }


Why is it dying after the first loop through?

Thanks in advance

 

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

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