foreach and form submission.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all.

I'm writing a script that accepts several different forms with different content. Depending on what data is sent with the form the script will do one or the other think.

Before the form data is processed I'd like to scrub it of HTML tags.

I can do this manually as below but the form may have dozens of items of data so I'd like to automate it.

$_POST['name'] = strip_tags($_POST['name']);
$_POST['address'] = strip_tags($_POST['address']);
$_POST['phone'] = strip_tags($_POST['phone']);

I saw a few lines of code once that used "foreach"  on the $_POST array elements and it did not seem to matter how many or what names the elements had.

Conceptually like this

foreach ($_POST - element) {
    $_POST-element = strip_tags($_POST-element)
}

Any ideas please ?

Thanks.

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux