use isset($checkbox) where $checkbox is the name of the check box on the
page that processes the form.

Steve Brett 
Internal Development 
EMIS Ltd. 

"Privileged and /or Confidential information may be contained in this
message. If you are not the original addressee indicated in this message (or
responsible for delivery of the message to such person), you may not copy or
deliver this message to anyone. In such case, please delete this message,
and notify us immediately. Opinions, conclusions and other information
expressed in this message are not given or endorsed by my firm or employer
unless otherwise indicated by an authorised representative independently of
this message."

Egton Medical Information Systems Limited. Registered in England. No
Registered Office: Park House Mews, 77 Back Lane, Off Broadway, Horsforth,
Leeds, LS18 4RF

> -----Original Message-----
> From: Randall Barber [mailto:[EMAIL PROTECTED]]
> Sent: 27 March 2001 16:14
> Subject: [PHP-DB] Editing DB entries via form
> 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,

PHP Database Mailing List (
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to