tags:

views:

67

answers:

1

ok so i collect the variable below through javascript.

var frameState = $(this).attr('id');

I have radio box that chooses no mats or one mat. When a box is chosen it reloads the page I want to put the variable framestate in the url: Sidenote - the code might not look great here but it all works I just don't know how to append the variable to the url after a radio choice is chosen.

  <tr>  
     <td>
      No Mats:  <input type="radio" name="mattes-radio" align="middle"<?php if($_GET['mattes'] == 0){ echo 'checked="checked"';} ?> id="mattes-radio-0"> 
     </td>
     </tr>  
     <tr>
     <td>
      Single Mat: <input type="radio" name="mattes-radio" <?php if($_GET['mattes'] == 1){ echo 'checked="checked"';} ?> id="mattes-radio-1"> 
     </td>
      </tr>


  $('#mattes-radio-0').click(function() {  
window.location = 'index-custom.php?mattes=0'; 
  });        

  $('#mattes-radio-1').click(function() {  
window.location = 'index-custom.php?mattes=1';
A: 

If I didn't understand your question wrongly...

This is the simplest way to do it

<input type="radio" id="mattes-radio-0" />
<script>
$("#mattes-radio-0").click(function(){
var param = $(this).attr('id').replace("mattes-radio-","");
window.location = 'index-custom.php?mattes='+param+'&framestate='+framestate;
});
</script>

Hope it helps

Roy Chan