• home
  • forum
  • my
  • kt
  • download
  • Forms - Check Boxes

    Author: 2007-06-30 18:54:52 From:

    The checkbox object is coded along the same lines as radio buttons, however each checkbox must get its own unique name since the state of "checked" or "not checked" will be passed to ASP for each box. Remember that you can set more than one option to be checked.

       filename=/learn/test/FormCheckBox.asp

    <html><head>
    <TITLE>FormCheckBox.asp</TITLE>
    </head><body bgcolor="#FFFFFF">
    <form action="FormCheckBoxRespond.asp" method="post">
    <p>CheckBox Form Example</p>
    <p>How do you want your order confirmed?</p>    
    <input TYPE="checkbox" NAME="USMail">confirmation sent by first class US Postal Service<br>
    <input TYPE="checkbox" NAME="UPS">confirmation sent by UPS overnight letter service<br>
    <input TYPE="checkbox" NAME="EMail" CHECKED>confirmation sent by EMail<br>
    <input TYPE="checkbox" NAME="Fax">confirmation sent by Fax<br>
    <input TYPE="checkbox" NAME="Tel" CHECKED>confirmation made by telephone call<br><br>
    <input type="submit"><input type="reset">
    </form><hr></body></html>
    

    The responder looks like this:

       filename=/learn/test/FormCheckBoxrespond.asp

    <html><head>
    <TITLE>formCheckBoxRespond.asp</TITLE>
    </head><body bgcolor="#FFFFFF">
    <%
    If  request.form("USMail")="on" then
       response.write "<br>We will confirm by US Mail"
    end if
    If  request.form("UPS")="on" then
       response.write "<br>We will confirm by UPS"
    end if
    If  request.form("EMail")="on" then
       response.write "<br>We will confirm by EMail"
    end if
    If  request.form("fax")="on" then
       response.write "<br>We will confirm by fax"
    end if
    If  request.form("tel")="on" then
       response.write "<br>We will confirm by tel"
    end if%>
    </body>
    </html>
    

    <Test Script Below>

    <Test Script Below>

    discuss this topic to forum

    relation tutorial

    No relevant information

    New

    Hot