Switch variables


Topic: Switch variables

rt133813 pro asked 6 years ago

This question might be out of scope, but I thought I would ask anyway.  The MDB switch looks great but, how do I assign "no" or "yes" to name="toggle_state".  I want to send "yes" or "no" to a PHP page to request $toggle_state so I can write it to a database table.  I am just not sure how to assign yes or no to name="toggle_state" the rest I can handle on my PHP page.  I am good with HTML and PHP, but not so good with javascript.  If I have to, I can parse out the javascript, but it takes me a while.  Here is what I have so far, and thanks for any help

<form action="toggle_onoff.php" method="post">
<label for="show_address">Show street address</label>
<div class="switch form-control">
<label>
No
<input id="show_address" name="toggle_state" type="checkbox" checked>
<span class="lever"></span> Yes
</label>
</div>
</form>

Bartłomiej Malanowski staff pro premium commented 6 years ago

Try this: https://stackoverflow.com/questions/43965929/single-checkbox-with-yes-or-no-values


rt133813 pro commented 6 years ago

I got it, your link set me on the right path.  Thank You


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue
  • User: Pro
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.5.15
  • Device: all
  • Browser: ll
  • OS: all
  • Provided sample code: No
  • Provided link: No