You are here: Re: Arrays and forms « All PHP « IT news, forums, messages
Re: Arrays and forms

Posted by mfrey on 05/24/05 15:06

its a bit hard to tell w/o knowing the relation between justification +
id... but with the set of test data, this could do it:

foreach($_POST['justification'] as $reason) {
echo $reason."-".each($_POST['prodID'])."<br>";
}

or maybe:

$count=0;
foreach($_POST['justification'] as $reason) {
echo $reason."-".$_POST['prodID'][$count]."<br>";
$count++;
}




Craig Keightley wrote:
> I have two elements in a form , a text area (justification[]) and a hidden
> field (prodID[])
>
> I have the following code as a test:
>
> foreach($_POST['justification'] as $reason) {
> echo $reason."<br>";
> }
> foreach($_POST['prodID'] as $pID) {
> echo $pID."<br>";
> }
>
> output
> item reason
> item reason 2
> item reason 3
> item reason 4
>
> id1
> id2
> id3
> id4
>
>
>
> How can i edit the code as such so that the following out put is displayed:
>
> item reason - id
> item reason 2 - id2
> item reason 3 - id3
> item reason 4 - id4
>
>
> Many Thanks for any help in advance
>
> Craig
>
>

 

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

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