0 Replies Latest reply on Feb 21, 2010 11:21 PM by venkatsyss

    Regarding checkboxes

    venkatsyss Level 1

      hi,

       

      My question is how i get the multiple selected checkbox value in httpservice and database in php.

       

      The following code shows

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
      layout="absolute" creationComplete="userRequest.send()">
      <mx:HTTPService id="userRequest" method="POST" useProxy="false"
      url="check.php" result="Display(event)">
           <mx:request xmlns="">
               <memid>{uRequest.selectedItem.userid}</memid>
           </mx:request>
      </mx:HTTPService>

      <mx:Script>
           <![CDATA[
               import mx.events.ListEvent;
               import mx.rpc.events.ResultEvent;
               import mx.collections.ArrayCollection;
               import mx.controls.Alert;
               import mx.controls.DataGrid;
               [Bindable]private var arr:ArrayCollection;
               private function Display(event:ResultEvent):void{
                   arr=event.result.users.user;

              }
               private function handleSelect(value:Boolean):void
                   {
                       userRequest.lastResult.users.user.source.forEach(
                           function callback(item:*, index:int,
      array:Array):void
                           {
                               item.sel = value;
                           });
                       userRequest.lastResult.users.user.refresh();
                   }
                   private function Update():void{
                       userRequest.send();
                   }

          ]]>
      </mx:Script>
      <mx:DataGrid dataProvider="{arr}" id="uRequest"
      itemClick="disp(event)">
      <mx:columns>
      <mx:DataGridColumn>
           <mx:itemRenderer>
           <mx:Component>
               <mx:CheckBox selected="{data.sel}">

              </mx:CheckBox>
           </mx:Component>
      </mx:itemRenderer>

          </mx:DataGridColumn>

          <mx:DataGridColumn headerText="Sl.No" dataField="userid"></
      mx:DataGridColumn>
               <mx:DataGridColumn dataField="username">

              </mx:DataGridColumn>
               <mx:DataGridColumn dataField="useremail">

              </mx:DataGridColumn>
               <mx:DataGridColumn dataField="userstate">

              </mx:DataGridColumn>

          </mx:columns>

      </mx:DataGrid>
      <mx:Button label="CheckAll" click="handleSelect(true)">

      </mx:Button>

      <mx:Button label="Update" click="Update()">

      </mx:Button>
      </mx:Application>

       

      //My Database Query

       

      if($_POST['memid']!=''){

              $id=implode(',',$_POST['memid']);

              $ids=substr($id,0,20);

              $ans="update tbl_member set member_lname='example' where member_id
      in($ids)";
               $res=mysql_query($ans);

              $answer="select * from tbl_member";
               $result=mysql_query($answer);

              print "<users>";

              while($row=mysql_fetch_object($result)){

              print "<user>
               <userid>".$row->member_id."</userid>
               <username>".$row->member_fname."</username>
               <useremail>".$row->member_lname."</useremail>
               <userstate>".$row->member_state."</userstate>
               </user>";

      }

              print"</users>";

       

      }

      Please provide me the solution to solve the problem.

       

      Thanks and Regards,

      venkat.R