You are here: Re: Initialize form values to NULL « All PHP « IT news, forums, messages
Re: Initialize form values to NULL

Posted by Steve on 08/24/07 04:27

| However, I have done this before using
| $_POST['<--hardCodedValueGoesHere-->'] = NULL;. I was wondering if there
| was a way to accomplish this with a loop structure instead of longhand,
| line-by-line for each form value....particularly if I have a form with 30+
| fields which I am required to build.

<snip>

| The reason I want to do what I want to do is two-fold:
|
| 1. Preserve entered data in the fields in case the form is not properly
| filled out.

which setting posted variables to null accomplished...in reverse. ;^)

| 2. Use an array structure for error checking and changing the CSS
| properties to visually indicate an error on the page.

which has nothing to do with setting the $_POST *array* values to null.

| --Like I said, I've done this before, I'm just looking for a short form
way
| to do it.

function senselessButAskedFor(&$value)
{
$value = null;
}

array_walk('senselessButAskedFor', $_POST);

short enough?

 

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

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