javascript - how to send parameters from js to php codeigniter -


i don't know i'm doing wrong , im stuck in part of project appreciated

here html:

<form id="form_search" method="post" action="/controler/something"> <select id="tip_fam" maxlength="100" > <option value="1">something 001</option> <option value="2">something 002</option> <option value="3">something 003</option> <ul id="print" class="bot"><li>print</li></ul> </form> 

js:

$("#print").click(function(){         url = base_url+"index.php/almacen/product/create_pdf/"+$("#tip_fam").val();         window.open(url,'',"width=800,height=600,menubars=no,resizable=no;")     }); 

php (codeigniter) :

public function create_pdf(){             $tip_fam = $this->input->post('tip_fam'); 

i thought value of select way when print in var_dump(), shows me "boolean false".

you don't have use javascript. way.

edit: can have more 1 submit button. check in function.

view:

<form id="form_search" method="post" action="/controller/something">      <select id="tip_fam" maxlength="100">         <option value="1">something 001</option>         <option value="2">something 002</option>         <option value="3">something 003</option>     </select>      <input type="submit" name="print" id="print" value="print">     <input type="submit" name="print" id="print" value="printandsave">  </form> 

controller:

public function something() {     // check button clicked     $submit_button = $this->input->post('print');      if( $submit_button == 'print' )     {         // print     }     elseif( $submit_button == 'printandsave' )     {         // print , save     } } 

Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -