Dr.CustUmz
01-12-2017, 03:38 PM
Solved with a little help from a friend
WHERE varname = 'drc_fl'
one of thoughs 'DOH' moments =)
So I have a link on my forumhome that only I can see, and when I click this link I'm trying to make it toggle the setting from on to off and vice versa.
this is how I have it setup.
the links code on forumhome:
<div id="drc_fl_container">
<if condition="$vboptions[drc_fl] == 1">
<div id="drc_fl_on" class="drc_fl_common">ON
<div class="drc_fl_fltr">
<a href="#" onclick="drcfl_off()">Switch</a>
<else />
<div id="drc_fl_off" class="drc_fl_common">OFF
<div class="drc_fl_fltr">
<a href="#" onclick="drcfl_on()">Switch</a>
</if>
</div>
</div>
</div>
the ajax script (switch):
function drcfl_off(){
$.ajax({
type: "GET", url: "?do=drcfloff"
});
}
function drcfl_on(){
$.ajax({
type: "GET", url: "?do=drcflon"
});
}
Plugin on global start:
require_once(DIR . '/includes/adminfunctions.php');
require_once(DIR . '/includes/functions_bigthree.php');
if ($_REQUEST['do'] == 'drcfloff'){
$db->query_write("
UPDATE " . TABLE_PREFIX . "setting
SET value = '0'
WHERE value = 'drc_fl'
");
}
if ($_REQUEST['do'] == 'drcflon'){
$db->query_write("
UPDATE " . TABLE_PREFIX . "setting
SET value = '1'
WHERE value = 'drc_fl'
");
}
build_options();
Am I doing this incorrectly? just needing a second set of eyes.
product is attached.
WHERE varname = 'drc_fl'
one of thoughs 'DOH' moments =)
So I have a link on my forumhome that only I can see, and when I click this link I'm trying to make it toggle the setting from on to off and vice versa.
this is how I have it setup.
the links code on forumhome:
<div id="drc_fl_container">
<if condition="$vboptions[drc_fl] == 1">
<div id="drc_fl_on" class="drc_fl_common">ON
<div class="drc_fl_fltr">
<a href="#" onclick="drcfl_off()">Switch</a>
<else />
<div id="drc_fl_off" class="drc_fl_common">OFF
<div class="drc_fl_fltr">
<a href="#" onclick="drcfl_on()">Switch</a>
</if>
</div>
</div>
</div>
the ajax script (switch):
function drcfl_off(){
$.ajax({
type: "GET", url: "?do=drcfloff"
});
}
function drcfl_on(){
$.ajax({
type: "GET", url: "?do=drcflon"
});
}
Plugin on global start:
require_once(DIR . '/includes/adminfunctions.php');
require_once(DIR . '/includes/functions_bigthree.php');
if ($_REQUEST['do'] == 'drcfloff'){
$db->query_write("
UPDATE " . TABLE_PREFIX . "setting
SET value = '0'
WHERE value = 'drc_fl'
");
}
if ($_REQUEST['do'] == 'drcflon'){
$db->query_write("
UPDATE " . TABLE_PREFIX . "setting
SET value = '1'
WHERE value = 'drc_fl'
");
}
build_options();
Am I doing this incorrectly? just needing a second set of eyes.
product is attached.