Hi Erwin.
I learn a lot of things from your suggestions. I am programnming with
PHP from short time so I am not expert as you are (you said: where is
the problem? Yes for me that was a problem); but I am sure that son I
will improve my skill with the help of people as you. So many thanks.
I solved my "problem". Instead of a numeric ID I have used a string
and I was able to pass an array of strings where the checkbox was
checked! The PHP is very powerful! Also I appreciated your suggestion
about the use of ' instead of \" but in that I have had the following
problem:
echo "<td> <inputtype='checkbox' name='ID[]'
value='".$row["email"]."'> </td>";
echo "<td> <input type=\"checkbox\" name=\"ID[]\"
value=\"".$row["email"]."\"> </td>";
The first statement don't work (I don't have parse error but the
checkbox don't appears); the second one work ok, so for now I am still
using the second form of statement.
If you can understand why this happens, it will be interesting for me
to know the reason.
Again many thanks and a Happy New Year to you and all your family.
Franco from Gaeta in Italy.
Erwin Moller <si******************************************@spam yourself.com> wrote in message news:<3f*********************@news.xs4all.nl>...
Franco Fellico' wrote:
Hi Franco
Hi everybody.
Suppose to have a table dinamically created in a form where I show
some
information of a set of row selected in a db-table:
......
while($row = mysql_fetch_array($result)) {
echo "<tr>";
echo "<td> <inputtype=\"checkbox\"name=\"checkbox$cnt\"value= \"checkbox\"
what is $cnt here? Is it increased somewhere?
And the value you attach to your checkbox is checkbox. ????
I think you should put some number (ID or Primary key or something unique)
in there.
Also use spaces between the different attributes!
SO this would be better:
echo "<td> <inputtype='checkbox' name='ID[]' value='<?= $row["ID"] ?>'>";
Now the script that receives the posting can retrieve the checked ID's like
this:
$id = $_POST["id"];
Now $id is an array containing all the id's that were checked.
Just loop through it and do your stuff with the database.
regards,
Erwin Moller
</td>";
echo "<td>".$row["ID"]."</td>";
echo "<td>".$row["field1"]."</td>";
echo "<td>".$row["email"]."</td>";
echo "</tr>";
}
after the table is showed, the user must select some rows checking the
related checkbox and then push a button to submit the form; at this
point I must start another page where I must do some work only on the
rows of the db-table referred by the ID where the checkbox is checked.
Can someone help me in solving this problem?
which problem? ;-)
Thank you from Franco in Italy