Re: radio buttons from MySQL query?
| From: | rija | Date: | Mon, 04 Nov 2002 03:33:41 +0000 |
| Subject: | Re: radio buttons from MySQL query? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-122607@lists.php.net to get a copy of this message | ||
I don't think so,
Put the bracket with your radio's name not with your the value///
For example :
print "<td width=2><input type=radio name=gl_acct[]
value=$row['acct']>{$row['acct']}</td>" ...
and so one/
----- Original Message -----
From: "David Jackson" <info@mustardandrelish.com>
To: <php-general@lists.php.net>
Sent: Monday, November 04, 2002 1:15 PM
Subject: [PHP] radio buttons from MySQL query?
> How do I go about building radio buttons using the results of a MySQL
> query. The record layout looks like this:
>
> acct
> cat
> description
>
> I want to use acct as the value="acct" in the input statement for the
> radio box. The code below almost works?
>
> TIA,
> David
>
>
> <?php
> $header = mysql_query ("SELECT * FROM chart
> ORDER BY acct ");
>
> if ($row = mysql_fetch_array($header)) {
> do {
> print("<tr bgcolor=\"white\" >");
> print '<td width="5"><input type="radio"
> name="gl_acct"
> value=acct[]"></td>';
> print("<td width=\"12\">");
> print $row["acct"];
> print "</td><td width=\"12\">";
> print $row["cat"];
> print "</td><td >";
> print $row["descript"];
> print("</td></tr>\n");
> } while($row = mysql_fetch_array($header));
>
> } else {print "Sorry, no records were found!";}
>
>
> ?>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>