HighDots Forums  

Dynamically created checkboxes with PHP

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss Dynamically created checkboxes with PHP in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Shaun
 
Posts: n/a

Default Dynamically created checkboxes with PHP - 07-16-2004 , 05:13 PM






Hi,

I have a form on my site that lists all of the projects in the system.

<tr>
<td>Test Project</td>
<td><input type="checkbox" value="11" ></td>
</tr>
etc...

How can I check which boxes have been ticked using PHP when the form is
submitted so the database can be updated appropriately?

Thanks for your help



Reply With Quote
  #2  
Old   
Michael Fesser
 
Posts: n/a

Default Re: Dynamically created checkboxes with PHP - 07-16-2004 , 06:33 PM






.oO(Shaun)

Quote:
I have a form on my site that lists all of the projects in the system.

tr
td>Test Project</td
td><input type="checkbox" value="11" ></td

/tr
etc...

How can I check which boxes have been ticked using PHP when the form is
submitted so the database can be updated appropriately?
1) Add a name-attribute to the input-element.
2) Dependent on the used submit method (get or post) check the global
arrays $_GET or $_POST for an element named like the input-element:

HTML:
<input type="checkbox" value="11" name="foo">

PHP:
$foo = isset($_GET['foo']);

Now $foo is either TRUE or FALSE, dependent on the checkbox status.

HTH
Micha


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.