Re: Dynamic check boxes...

From: Date: Sat, 25 Aug 2001 01:12:31 +0000
Subject: Re: Dynamic check boxes...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-64356@lists.php.net to get a copy of this message
Datum verz. Thu, 23 Aug 2001 14:17:28 -0400 Onderwerp: [PHP] Dynamic check boxes... > I have a form where users can enter a link (kind of a free for al links = > When I load an admin script I can check all of the ones that have a 0 in = > that field. I want to have checkboxes form down the side of them so I = can > check the ones I want approved. =20 I suppposathe table has some ID field which i will call proposalID. Admin page. form: echo '<form.... query (SELECT proposalID, proposalText WHERE proposals=new) while{ echo "<input type='checkbox' name='FORM$proposalID' value='Yes'> $proposalText"; } echo '<submit button> </form>'; Then you get the form back Suppose the ID is 129 then the variable will be called $FORM129 (This is what i use the very useful $$ function for. $helpvar='FORM'.$proposalID; now $$helpvar gives the same as $FORM129 !) mysql_query (SELECT proposalID WHERE proposals=new) while...... { $helpvar='FORM'.$proposalID; if (isset($$helpvar) AND ($$helpvar=='Yes')) {$array_accepted[]=$proposalID notify_sender('ok'); } else { $array_rejected[]=... notify_sender('refused'); } } $query=" (UPDATE tablename SET accepted='0' WHERE proposalID="; for ($i=0;$i<count($array_accepted);$i==) {$query.=$array_accepted[$i].',' } #get rid of the last comma somehow... $query.=" )"; do query same for rejected but delete these or mark as rejected. let me know! Chris H. -------------------------------------------------------------------- -- C.Hayes Droevendaal 35 6708 PB Wageningen the Netherlands -- --------------------------------------------------------------------

« previous php.general (#64356) next »