Gmail " select all" implementation

I have been trying to work on select all functionality …but i am not able to do that .
Can anybody help giving me the source code for the same ?
Thanks !

I assume you are talking about checkboxes in a form you are creating if so here is an article it has everything you need to do this with jquery:
http://briancray.com/2009/08/06/check-all-jquery-javascript/

Can you please tell me how to do with PHP ?

php can’t do that! php does not add check marks. you have to use javascript for that otherwise if it is for deleting something you can just create a button that says delete all and if they click on that button you would delete everything

Form Html

<td>article<br /><input name="article" type="checkbox" value="your articles ID #" /></td> <td>All<br /><input name="checkall" onclick="checkedAll();" type="checkbox" value="" /></td>

Javascript

function checkedAll () { if (checked == false){checked = true}else{checked = false} for (var i = 0; i < document.getElementById('editform').elements.length; i++) { document.getElementById('editform').elements[i].checked = checked; } }

Php
[php]if(is_array($_POST[‘article’])) foreach($_POST[‘article’] as $value){
$this->removeArticle($value);
}

   function removeArticle($value) {
	Run your delete WHERE id = '$vlue' ");
return true;

}[/php]

This should get you on the right track. Edit it so it fits into your site.

Sponsor our Newsletter | Privacy Policy | Terms of Service