plugins - wordpress custom admin page - checkbox -


I am trying to create a plugin that adds a custom page to the admin panel. I have a checkbox named "deposit_sandbox", if true, it should correct the option in the database, if it is not selected, then it should update the option in the database incorrectly.

How do I check, the checkbox was selected, and then can the database be updated with update_opthi () function?

This works if I leave the action blank and then use $ _POST, but I will need to do this for each item in my form, if there is any action please let me know If your option has the same name as the checkbox, you can type the following:

  $ options_names = array ("deposit_sandbox", "name2", "name3"); Forex Currency ($ options_names $ as option_name) {$ check = release ($ _ POST [$ option_name]); Update_option ($ option_name, $ check); }  

I do not remember that update_option accepts boolean values ​​(such as $ check in my example) If this does not happen, then $ checks Convert the line to $ checked = isset ($ _ POST ["deposit_sandbox"])? 1: 0; .

I am thinking that when you activate the plugin, you make the default value in all your options.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -