Re: form question
| From: | Monte Ohrt | Date: | Tue, 18 Jul 2000 20:33:45 +0000 |
| Subject: | Re: form question | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-7150@lists.php.net to get a copy of this message | ||
Ok, so would this work for you?
echo(sprintf("<input type=\"checkbox\" name=fila_art[] value=\"%s\"
checked>",
$fila_art[a_id]);
Then you could just traverse the fila_art[] array in your php script.
"Martin A. Marques" wrote:
>
> On Tue, 18 Jul 2000, Monte Ohrt wrote:
> >
> > Martin,
> >
> > I've run into this problem many times myself.
> >
> > I'm sure there are methods or hacks to achieve what you are asking, but
> > I usually try to figure out a better way to create my form so that it is
> > easier to parse, like making the form variable names consistant and
> > making the values dynamic, or putting hidden values along side of form
> > elements to track corresponding data.
> >
> > What does your form elements consist of exactly?
>
> <form action="../informix/index.php" method="post">
> <?
> $conn_id=ifx_pconnect("diario","ifx_user","Passssss");
>
> $no_leidos_id=ifx_query("SELECT a_id,a_diario,a_titulo,a_fecha,a_usuario,
> a_lectura FROM articulo WHERE a_lectura=0",$conn_id);
>
> $fila_art=ifx_fetch_row($no_leidos_id,"NEXT");
>
> while (is_array($fila_art)){
> echo "<tr> \n";
> echo "<td>";
> echo(sprintf("<input type=\"checkbox\" name=\"%s\"
> checked>",
> $fila_art[a_id]);
> echo "</td>";
> reset($fila_art);
> for (next($fila_art);$col=key($fila_art);next($fila_art)){
> if ($col!="a_lectura") {
> echo "<td>\n";
> echo(sprintf("%s \n",$fila_art[$col]));
> echo "</td>\n";
> }
> }
> echo "</tr> \n";
> $fila_art=ifx_fetch_row($no_leidos_id,"NEXT");
> }
>
> ?>
> <br>
> <input name="actualizacion" type="sumit"
> value="Actualizar">
> </form>
>
> Something like this. As you can see, the values of the names of the
> checkboxes are numbres (the numbre id of an article), which I need to now
> later which ones where checked and which ones where not.
>
> Any idea?
>
> --
> "And I'm happy, because you make me feel good, about me." - Melvin Udall
> -----------------------------------------------------------------
> Martín Marqués email: martin@math.unl.edu.ar
> Santa Fe - Argentina http://math.unl.edu.ar/~martin/
> Administrador de sistemas en math.unl.edu.ar
> -----------------------------------------------------------------
--
Monte Ohrt <monte@ispi.net>
http://www.ispi.net/