0

Does anyone know how to set the value of a jQuery mobile flip switch using just php? I have tried the below without any luck. Any ideas would be appreciated!

<?php 
    ifFilled = '1';
?>

<select name="flip-min" id="flip-min" data-role="slider">
    <option value="1" <?php echo $isFilled == '1' ? ' selected="selected"' : '';?>>Filled</option>
    <option value="0" <?php echo $isFilled == '0' ? ' selected="selected"' : '';?>>Un-Filled</option>
</select>
Austin
  • 1,619
  • 7
  • 25
  • 51

2 Answers2

0

Do it with JavaScript:

Look at this fiddle first.

<label for="flip-a">Select slider:</label>
<select name="slider" id="flipMe" data-role="slider">
    <option value="off">Off</option>
    <option value="on">On</option>
</select> 

<?php if ($ifFilled == true): ?>
var fts = $('#flipMe');
fts.val('on');
fts.slider('refresh');
<?php endif; ?>
David
  • 3,831
  • 2
  • 28
  • 38
0

opps $ifFilled does not match $isFilled lol dummy of the year award over here!!! the code works fine other than that....

Austin
  • 1,619
  • 7
  • 25
  • 51