Re: Generating readio buttons

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Here's your problem:

"acct[]" doesn't equal anything.

$acct[4] might.

So:

echo "<input type='radio' name='gl_acct' value='{$acct[4]}'>";

might give you want you want.

The name='acct[]' is used for PHP form processing, putting the correct
value in the variable.  For example, $acct[Yes] might be set if you used
this input and it was checked:

<input type='checkbox' name='acct[]' value='Yes'>

Peter

On Sun, 3 Nov 2002, David Jackson wrote:

> Peter Beckman wrote:
>
> Peter,
> Thanks for your prompt reply.
>
> > Gonna need some additional information, such as:
> >
> >  1. The first three rows your query returns
> >  2. The expected output
> >  3. The actual problem and/or error.
>
> What I'm trying todo is build a radio box form
> for the selection of ledger accounts for a account app.
> ( http://mustardandrelish.com/ledger)
>
> Query returns (from HTML table):
> <input type="radio" name="gl_acct" value=acct[]">
> <input type="radio" name="gl_acct" value=acct[]">
> <input type="radio" name="gl_acct" value=acct[]">
>
> Expected results might be:
>
> <input type="radio" name="gl_acct" value="1000" ">
> <input type="radio" name="gl_acct" value="2000" ">
> <input type="radio" name="gl_acct" value="3000" ">
>
> And then "gl_acct" will be passed to the G/L entry screen
> (sticky forms?)
>
> TIA,
> David
>
>
> >
> > Peter
> >
> > On Sun, 3 Nov 2002, David Jackson wrote:
> >
> >
> >>Howdy --
> >>How do I dynamically generate the "value" for radio buttons off the DB
> >>(MySQL) backend? Here's some code that almost works
> >>
> >>TIA,
> >>David
> >>
> >>--------------------- Almost works ----------------------------
> >><?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 Database Mailing List (http://www.php.net/)
> >>To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >
> >
> > ---------------------------------------------------------------------------
> > Peter Beckman            Systems Engineer, Fairfax Cable Access Corporation
> > beckman@purplecow.com                             http://www.purplecow.com/
> > ---------------------------------------------------------------------------
> >
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

---------------------------------------------------------------------------
Peter Beckman            Systems Engineer, Fairfax Cable Access Corporation
beckman@purplecow.com                             http://www.purplecow.com/
---------------------------------------------------------------------------


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux