Reply to Re: [PHP] parsing values from a form post

Your name:

Reply:


Posted by trlists on 04/09/05 04:13

On 8 Apr 2005 Chris Bruce wrote:

> I need to be able to break out the tax, amount and type that were
> entered on each line of a form and then apply calculations and do
> database inserts on each. As you can see what I need is in sets of
> three denoted by the integer at the end (tax0, amount0, type0, tax1
> etc.)
>
> I can't figure out how to separate these variables and values so that I
> can do what I need to do.

The other suggestion is a good one but if you want to do it with the
variables as you named them you can also use something like this:

for ($i = 0; $i < $maxlines; $i++) {
$tax = $_POST['tax' . $i];
$amount = $_POST['amount' . $i];
$type = $_POST['type' . $i];
.....
}

There is more one should usually do here, for security -- anything
coming in via _POST should be processed through functions designed to
remove malicious data. For example, an approach something like this:

$value = strip_tags((substr(trim($_POST[$fldname]), 0, MAX_LEN));

--
Tom

[Back to original 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

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