You are here: Re: Dynamic Form Update « PHP Programming Language « IT news, forums, messages
Re: Dynamic Form Update

Posted by ScareCrowe on 05/10/05 05:53

--ScareCrowe
"Daniel Tryba" <partmapsswen@invalid.tryba.nl> wrote in message
news:427f27a5$0$52565$c5fe704e@news6.xs4all.nl...
> In comp.lang.php Craig Keightley <dont@spam.me> wrote:
> > <input type = "hidden" name ="idn" value="n"><input type ="qtyn" value
="1">
>
> This doens't make any sense in html.
>
> > how do i generate an array for a foreach loop to update the values in
PHP
>
> <input type='hidden' name='qty[n]' value='x'>
>
> should give you an array in _GET/_POST with the name qty, keys are 'n'
> and values are 'x'.
>
> FUP: comp.lang.php

Actually, it makes sense to me though. ( <input type="hidden" name="idn"
value="n"> is correct HTML, although it is spaced incorrectly, it is just as
good as spelling doesn't like so: doens't ;P )
I think he is asking how to insert multiple entries into a DB passed from a
form.
Assuming you know how many entries there will be, just iterate thru it with
a for loop. If you have 10 entries, for($a=0;$a<10;$a++) etc etc.

Otherwise:

I do agree using form element variables as an array like id[1], id[2]
instead of id1, id2. This way, when you go through the loop you can do
something like this:
$id_count = count($_POST['id']);
for($b=0;$b<$id_count;$b++){
mysql_query("INSERT INTO blahblah values ($_POST[id][$b],
$_POST[qty][$b]");
}
Not CnP, but you should get the point from that!

--ScareCrowe

 

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

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