What I have is an extremely scaled down version of a news DB.

What I am not experienced in doing is the following:

I want to have a page, say 'myEditNews.php'--and it will list the news items in the 
database with a checkbox and an edit button.
The check box will be used for marking news items to delete.  The edit button is 
obvious :).

HOW:

Say a person checks the 1, 5, and 9 check boxes and hits delete.  How do I know in the 
myEditNews.php file that those particular boxes were checked??  When I figure this 
out, I will use a loop to delete the news items one at a time from the database 
(unless there is a better way).

My understanding of check boxes is that they are not sent from the form unless they 
are checked.

Here's what I have so far:

1) Use hidden fields as flags.  All hidden fields have same name so that when they are 
submitted to PHP they go into an ordered array.
2) The corresponding checkbox fields will be checked.  The value of the checkbox will 
have the news item DB primary key ID to delete on.

--------------------
for(i=0; odbc_fetch_row(...) != false; i++)
{
    echo "<input type='hidden' name='newsItem' value='0'><input type=checkbox 
name='newsItem".i."' onClick='javascript:if(document.myForm.newsItem[".i."].value == 
0)  { document.myForm.newsItem[".i."].value = 1 } else { 
document.myForm.newsItem[".i."].value = 1; }'>";
}

Am I making this hard on myself?  I have seen it done, but now that I want to find an 
example these sites escape my notice.
Any help is appreciated,
RDB

Reply via email to