php - How do I set a default query string in my URL? -


i trying build webapp shall filter results based on users current button select , slider choice, achieving via php, sql , ajax calls need sending correct data url.

db dip -

$ptype = $_get['s'];  $fpsival = '15000'; $fgpmval = '10000'; $hpsival = '30000'; $hgpmval = '10000';  $sql = "select * pumps          pump_type =  '$ptype'         , flow_psi   <=  '$fpsival'         , flow_gpm   <=  '$fgpmval'         , high_psi   <=  '$hpsival'         , high_gpm   <=  '$hgpmval'"; 

i want set default value ptype of ?ptype=continuous instead of having static variable, how pass url when page called initially?

in order handle user result filtering created form method of understand should send data url upon submission, nothing happens , not quite sure have done wrong

get form -

 <form name="pumpcat" action="?s=<?php echo $ptype ?>" method="get" align="center">      <div class="btn-group" data-toggle="buttons-radio">           <button type="submit" class="<?php if( $ptype == 'intermittent' ){ echo 'active '; } else echo 'noclass '; ?>btn btn-primary waitinguibut" id="but1" name="s" value="intermittent" action="pumpcat">intermittent</button>           <button type="submit" class="<?php if( $ptype == 'continuous' ){ echo 'active '; } else echo 'noclass '; ?>btn btn-primary waitinguibut" id="but4" name="s" value="continuous"action="pumpcat">continuous</button>         </div>  </form> 

any pointers appreciated.

your action="?ptype=" seems set default value but, there no 'href' attribute in button. try using element proper href , use submit form.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -