vendredi 20 avril 2018

classic asp if checkbox is checked else checkbox not checked

Hi I'm new to classic asp and i just can't get my head around this simple problem. I have a form with 2 checkbox's in and this is the result i want:

If the user checks both checkbox's then insert a certain value into the database. Else insert a different value into the database. I've tried a few things but at the moment i'm trying to check if the checkbox doesn't have a value then insert but the else always fires. By default the user has to accept the terms checkbox.

Hope this makes sense. Thanks

  <p>  <input type="checkbox" name="Privacy" value="1" id="Privacy" >privacy checkbox<a href="javascript:void(0)" onclick="document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'"><img src="/images/qmark.png" /></a></p>

  <p> <input onchange="this.setCustomValidity(validity.valueMissing ? 'Please indicate that you accept the Terms and Conditions' : '');" id="field_terms" type="checkbox" name="Terms" value="2" >I accept Terms and Conditions</p> 

Then my asp looks like:

if Request.form("Privacy") <> "" Then

SQL = "INSERT INTO table1 (t1_accept) VALUES('N')"
cnSub.execute SQL
Else

SQL = "INSERT INTO table1 (t1_accept) VALUES('Y')"
cnSub.execute SQL

End If




Aucun commentaire:

Enregistrer un commentaire