<?php

global $wpdb;

if(get_option(‘registerbid’) ==” && isset($_POST[‘maxrg’]) != ‘submit’){

add_option( ‘registerbid’, true, ”, ‘yes’ );

}

if(get_option(‘drivebyreport’) ==” && isset($_POST[‘maxrg’]) != ‘submit’){

add_option( ‘drivebyreport’, true, ”, ‘yes’ );

}

if(get_option(‘placebid’) ==” && isset($_POST[‘maxrg’]) != ‘submit’){

add_option( ‘placebid’, true, ”, ‘yes’ );

}

//echo $_POST[‘maxrg’];

//on submit

if(isset($_POST[‘maxrg’]) == ‘submit’){

$REQUESTregisterbid = $_REQUEST[‘registerbid’] ? true : false;

$REQUESTdrivebyreport = $_REQUEST[‘drivebyreport’] ? true : false;

$REQUESTplacebid = $_REQUEST[‘placebid’] ? true : false;

update_option( ‘registerbid’, $REQUESTregisterbid, ”, ‘yes’ );

update_option( ‘drivebyreport’, $REQUESTdrivebyreport, ”, ‘yes’ );

update_option( ‘placebid’, $REQUESTplacebid, ”, ‘yes’ );

}

$registerbid = get_option(‘registerbid’);

$drivebyreport = get_option(‘drivebyreport’);

$placebid = get_option(‘placebid’);

?>

<div class=”mainbx”>

<form action=”” method=”post” id=”backedform” name=”backedform”>

<input type=”checkbox” name=”registerbid” id=”registerbid” value=”<?php echo $registerbid;?>”  <?php echo (isset($registerbid) && $registerbid == ‘1’ ? checked : ”); ?>/>

<input type=”checkbox” name=”drivebyreport” id=”drivebyreport” value=”<?php echo $drivebyreport;?>” <?php echo (isset($drivebyreport) && $drivebyreport == ‘1’ ? checked : ”); ?>/>

<input type=”checkbox” name=”placebid” id=”placebid” value=”<?php echo $placebid;?>” <?php echo (isset($placebid) && $placebid == ‘1’ ? checked : ”); ?>/>

<input type=”submit” name=”maxrg” value=”submit” />

</form>

</div>

<script>

jQuery(document).ready(function() {

//set initial state.

if(jQuery(‘#registerbid’).is(“:checked”)) {

jQuery(‘#registerbid’).val(1);

}

if(jQuery(‘#drivebyreport’).is(“:checked”)) {

jQuery(‘#drivebyreport’).val(1);

}

if(jQuery(‘#placebid’).is(“:checked”)) {

jQuery(‘#placebid’).val(1);

}

jQuery(‘#registerbid’).change(function() {

if(jQuery(this).is(“:checked”)) {

jQuery(this).val(1);

}else{

jQuery(this).val(”);

}

}

);

jQuery(‘#drivebyreport’).change(function() {

if(jQuery(this).is(“:checked”)) {

jQuery(this).val(1);

}else{

jQuery(this).val(”);

}

}

);

jQuery(‘#placebid’).change(function() {

if(jQuery(this).is(“:checked”)) {

jQuery(this).val(1);

}else{

jQuery(this).val(”);

}

}

);

});

</script>

Please login or Register to submit your answer
Not the answer you are looking for? Browse other questions tagged or ask your own question.