Re[2]: [PHP] composed variables
| From: | Àíòîí | Date: | Tue, 20 May 2003 10:42:04 +0000 |
| Subject: | Re[2]: [PHP] composed variables | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-148280@lists.php.net to get a copy of this message | ||
Hi
>
>> hello Jay!
>> The idea behind is to have an universal script, which can
>> handle different
>> forms, which have a different amount of variables to post, based on a
>> database. I get back the amount of fields needed (same amount as the
>> database fields). Because I do not know the amount of
>> variables out of the
>> form I want to perform that while ... which gives back
>> $var1=$_POST["val1"]; to $varx ...
>> Better description?
>> Thanx for your help!
>> Mike
>> "Jay Blanchard" <jay.blanchard@niicommunications.com> schrieb
>> im Newsbeitrag
>> news:C8F323573C030A448F3E5A2B6FE2070B02A142@nemesis...
>> [snip]
>> I am trying to create a composed variable:
>> I get from a form the amount of variables back, eg. 4
>> I need now a way to perform something like
>> while ($i >= $anzVar) {
>> ...
>> which creates variables: $var1, $var2 and so on.
>> [/snip]
My advise is to use something about this:
<form method="POST">
<input type="text" name="$vars[Firstname]">
<input type="text" name="$vars[Secondname]">
...
</form>
and php script:
foreach ($_POST['vars'] as $key=>$value)
{
print "$key=>$value<br>";
}
this script will print something about
Firstname: Jack
Secondname: Smith
...
--
Regards
Anton