Re: Re[4]: [PHP] checkbox

From: Date: Sun, 26 Nov 2000 00:08:00 +0000
Subject: Re: Re[4]: [PHP] checkbox
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-27202@lists.php.net to get a copy of this message
Hello: then use such solution: function printradio($name,$toset){ if ($toset=="yes") $checkit="checked"; print "<input type=\"radio\" name=\"$name\" value=\"$toset\" $checkit> $toset\n": } printradio("frontpage",$row[frontpage]); But you haven't told in which way you store your yes/no in the database. Unless you to i cannot give an exact detail. bye Folke On Sat, 25 Nov 2000, Richard Kurth wrote: > Hello Folke, > > I realize what I am doing wrong the form that puts the data in the > database looks like this for the checkbox > > <input type="radio" name="Frontpage" value="YES">YES > <input type="radio" name="Frontpage" value="NO" checked>NO > > The form for updating the database would look somthing like this > > <input type="radio" name="Frontpage" value="<?php echo > $row["frontpage"] ?>"> > Now my question is how do I pull the yes or no from the database and > show it in the form. > > FA> Hi Richard, > > FA> i can't write the if condition for because i don't know what > FA> you expect in the mySQL-field for an checked checkbox and what for an > FA> unchecked. > FA> for example : > > FA> <?php if ($row[frontpage]=="Y") print " checked"?> > > FA> ok? > > FA> regards > FA> Folke > > > > > -- > Best regards, > Richard mailto:rkurth@pacifier.com > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#27202) next »