You are here: Re: php arrays « HTML « IT news, forums, messages
Re: php arrays

Posted by Toby Inkster on 03/23/06 01:20

wes wrote:

> Thanks, i have a solution that works in a similar way. I have another
> question. I have checkboxes in a php script. The number of checkboxes
> depends on the number of records in my database.

I'd do something like this:

<?php
$i = 0;
foreach ($database_rows as $r)
{
$i++;
print "<input type=checkbox value=1 name=chk$i>\n";
}
print "<input type=hidden value=$i name=nchk>\n";
?>

then the reading script does:

<?php
$number_of_checkboxes = $_REQUEST['nchk'];
for ($i=1; $i<=$number_of_checkboxes; $i++)
$chk[$i] = $_REQUEST['chk'.$i];
?>

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

 

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

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