[thelist] any/all post data

Jack Timmons jorachim at gmail.com
Sun Apr 19 12:54:30 CDT 2009


On Sun, Apr 19, 2009 at 12:29 PM, Bob Meetin <bobm at dottedi.biz> wrote:
> would i then be able run a filter (check for
> certain content) and if it contains that content, prevent it from
> submitting or other?
>
> say something like:
>
> foreach($_POST as $k=>$v)
> {
>    $post_data[$k] = $v
>    $post1 = $post_data[0];
>    $post2 = $post_data[1];
>    if ( $post1 == "good morning jim" ) { echo "wrong timezone you
> bum!<br />"; }
>    if ( $post2 == "ciao" ) { echo "good bye!<br />"; }
>    // etc.....
> }

You can have your for loop process the data in the array (replace POST
with GET as needed), and set up the logic in the form handle to either
check for errors (I usually use an error array, keys being error type,
and values being message, such as $error["invalid_character_length"] =
"You need to supply a password with a length greater than 8
characters), or have the for loop do it's own directing.

If the data being posted is being placed in post is either both an
array or a string (say post['affiliate'] is a string, post['food'] is
an array), all you have to do is a simple is_array check on the key,
and determine where you need to go from there.

Be glad to offer more help if needed.

-- 
-Jack Timmons
http://www.trotlc.com
Twitter: @codeacula



More information about the thelist mailing list