2012-12-03 2 views
0

나는 xend 프레임 워크를 사용하여 PHP 형식을 가지고 있습니다. 난 내가 컨트롤러에 무슨 문제가 라디오 버튼젠드 양식 게시 변수를 얻는 방법

이 값을 얻는이다 데

if ($this->getRequest()->isXmlHttpRequest()) { 
      if ($this->getRequest()->isPost()) { 
       // check session for line and dataset function 
       // update queue 
       $data = $this->_request->getParams(); 
     print_r($_POST['locations']); 
     exit(); 
       $this->submitAction(); 
      } 
     } 

형태

class Application_Form_LineData extends Zend_Form 
{ 
    private $lineId; 
    private $dataId; 
    private $name; 

    public function init() 
    { 
     /* Form Elements & Other Definitions Here ... */ 
    } 

    public $elementDecoration = array(
      'ViewHelper', 
      //'Description', 
      //'Errors', 
      array(array('data'=>'HtmlTag'), array('tag' => 'td')), 
      //array('Label', array('tag' => 'td')), 
      //array('Errors'), 
      //array(array('row'=>'HtmlTag'),array('tag'=>'tr')) 
    ); 

    public $elementRowDecoration = array(
      'ViewHelper', 
      array(array('row' => 'HtmlTag'), array('tag' => 'tr')) 
    ); 

    public $elementTableDecoration = array(
      'ViewHelper', 
      array(array('data' => 'HtmlTag'), array('tag' => 'td')), 
      array(array('row' => 'HtmlTag'), array('tag' => 'tr')) 
    ); 

    public $formDecoration = array(
      'FormElements', 
      array(array('data'=>'HtmlTag'), array('tag'=>'table', 'class'=>'forms')), 
      'Form' 
    ); 


    public function setLineId($lineId) 
    { 
     $this->lineId = $lineId; 
    } 

    public function setName($name) 
    { 
     $this->name = $name; 
    } 

    public function setDataId($dataId) 
    { 
     $this->dataId = $dataId; 
    } 

    public function startform($entries) 
    { 
     $this->setMethod('post') ->setAttrib('enctype', 'multipart/form-data'); 

     $count = count($entries); 
     for($i=0;$i<$count;$i++){ 

      $this->addElement('checkbox', 'l_'.$entries[$i]['PGA_Id'], array(
        'decorators' => $this->elementDecoration, 
        'onclick' => 'updateQueue('.$entries[$i]['PGA_Id'].',false)', 

      )); 



      // Data sets for each line 

      $countData = count($entries[$i]['Data_Set']); 
      for($x=0;$x<$countData;$x++){ 

       $this->addElement('checkbox', 'ds_'.$entries[$i]['Data_Set'][$x]['PGA_Id'], array(
         'id' => 'ds_'.$entries[$i]['Data_Set'][$x]['PGA_Id'], 
         'decorators' => $this->elementDecoration, 
         'class' => 'line_'.$entries[$i]['PGA_Id'], 
         'onclick' => 'updateQueue('.$entries[$i]['PGA_Id'].','.$entries[$i]['Data_Set'][$x]['PGA_Id'].')', 
         'name' => 'line_'.$entries[$i]['PGA_Id'], 

       )); 
      } 


     } 

     $this->addElement('radio', 'locations', array(
       //'label' => 'Download to: ', 
       'multiOptions' => array(
         'woking' => 'Woking', 
         'cairo' => 'Cairo' 
       ), 
       'decorators' => $this->elementDecoration 
     )); 

     $this->addElement('submit', 'submit', array(
       'ignore' => true, 
       'label' => 'Add to queue', 
       'decorators' => $this->elementDecoration 
     )); 

     return $this; 
    } 
} 

나는의 위치 값을 얻으려면 라디오 박스.

나는 양식을 전달하는 아약스를 사용하여 작동하지 않는 이유를 생각하려고 하루 종일 보냈다

<script type="text/javascript"> 
<!-- 
$(function() { 
    showhide("dataqueue"); 
}); 
//--> 
</script> 

    <!-- display queue for project --> 
    <div id="dataqueue"> 
     <?php echo $this->dataQueueTable($this->queue,$this->qstatus); ?> 
    </div> 

    <div id="datalist"> 
    <form method="post"> 
    <table class=table> 
     <tr> 
      <!-- <th class="tdid">ID</th> --> 
      <th class="tdname">Name</th> 
      <!-- <th>Path</th> --> 
      <th>Add to Queue</th> 
     </tr> 
     <?php 

     foreach ($this->entries as $entry){ ?> 
     <tr class=parent id=<?=$entry['PGA_Id'] ?>> 
      <!-- <td><?php echo $entry['PGA_Id'] ?></td> --> 
      <td><?php echo $entry['PGA_Name'] ?> </td> 

      <?php //echo $this->form->getElement('l_'.$entry['PGA_Id']) ?> 

      <?php 
      foreach($entry['Data_Set'] as $data){ 
      ?> 
      <tr class=child-<?=$entry['PGA_Id'] ?>> 
      <td colspan="3"> 
      <table class="tdatasets"> 
       <tr> 
        <!-- <td class="tdid"><?php echo $data['PGA_Id'] ;?></td> --> 
        <td class="subtdname"><?php echo $data['PGA_Name'] ; ?></td> 
        <!-- <td><?php echo $data['PGA_Path'] ; ?></td> --> 
        <?php echo $this->form->getElement('ds_'.$data['PGA_Id']) ?> 
        <td><?php echo $data['size']; ?></td> 
       </tr> 
      </table> 
      </td> 
      </tr> 
      <?php } ?> 

     </tr> 
     <?php } ?> 
     <tr> 
      <td style="">Download to:</td> 
      <?php echo $this->form->getElement('locations') ?> 
      <?php echo $this->form->getElement('submit') ?> 
     </tr> 
    </table> 
    </form> 
    </div> 


    <div id="notification"> 
     <?php echo $this->notificationTable($this->notification,$this->notificationform); ?> 
    </div> 
+0

downvote에 대한 의견을 남길 수 있습니까? – shorif2000

+1

많은 코드와 매우 간단한 질문이 있기 때문에 생각합니다 :) Upvoted))) –

답변

1
$this->getRequest()->getParams();