SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Non-Member
    Join Date
    Apr 2007
    Posts
    224
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to add required to agree to T & C checkbox

    How can I add a checkbox that's required to be checked, before this form info is submitted, with text saying You Must Agree To The Terms & Conditions,
    or this form can't be submitted unless the box is checked?

    And a link from the words Terms & Conditions. thanks....

    This is the page I want to add it to the bottom of:


    Code:
    <?php 	global $account;	?>
    
    <script language="javascript" type="text/javascript"> function populate(frm){     frm.email.value = frm.user_name.value } </script> 
    
    <form method="POST" action="index.php"> 
    
    <TABLE align='center' width="440" valign='top' cellpadding="0" cellspacing="1" style='border:1px solid gray' style="padding: 5px;" >
    <tr><td>&nbsp;</td></tr> 
    
    <input class='field' type='hidden' name='command' value='account'> <input class='field' type='hidden' name='param' value='signup'> <tr><td colspan='2' class='pageTitle'><div class='hLine'><font face="Arial" color="#000000" size="3">Create New Account</font></div></td></tr> <tr><td>&nbsp;</td></tr> <tr> <td class='fieldLabel' width="30%"><font face="Arial" color="#6B6B6B" size="2">Membership Type</font></td> 
    
    <td align="center">[account_type_panel]</td></tr> <tr><td>&nbsp;</td></tr> <tr> <td class='fieldLabel' width="30%"><font face="Arial" color="#6B6B6B" size="2">&nbsp;User Name</font></td> <td><input class='field' type='text' size='30' onBlur="populate(this.form);" maxlength="30" name='user_name' value='<?=$account->user_name ?>'> <span class='requiredField'>&nbsp;*&nbsp;</span><span class='errorMessage'><?=$account->get_error('user_name') ?></span></td> </tr> 
    
    <tr> <td class='fieldLabel'><font face="Arial" color="#6B6B6B" size="2">&nbsp;Password</font></td> <td><input class='field' type='password' size='30' maxlength="30" name='password' value='<?=$account->password ?>'> <span class='requiredField'>&nbsp;*&nbsp;</span><span class='errorMessage'><?=$account->get_error('password') ?></span></td> </tr>
    
    <tr> <td class='fieldLabel'><font face="Arial" color="#6B6B6B" size="2">&nbsp;Re-Enter Password</font></td> <td><input class='field' type='password' size='30' maxlength="30" name='reenter_password' value='<?=$account->reenter_password ?>'> <span class='requiredField'>&nbsp;*&nbsp;</span><span class='errorMessage'><?=$account->get_error('reenter_password') ?></span></td> </tr> 
    
    <tr> <td class='fieldLabel'><font face="Arial" color="#6B6B6B" size="2">&nbsp;First Name</font> </td> <td ><input class='field' type='text' size='40' maxlength="50" name='first_name' value='<?=$account->first_name ?>'> <span class='requiredField'>&nbsp;*&nbsp</span><span class='errorMessage'><?=$account->get_error('first_name') ?></span></td>  </tr>
     
    <tr> <td class='fieldLabel'><font face="Arial" color="#6B6B6B" size="2">&nbsp;Last Name</font></td> <td><input class='field' type='text' size='40' maxlength="50" name='last_name' value='<?=$account->last_name ?>'> <span class='requiredField'>&nbsp;*&nbsp;</span><span class='errorMessage'><?=$account->get_error('last_name') ?></span></td> 
    
    </tr> <tr><td></td></tr><tr><td class='fieldLabel'><font face="Arial" color="#6B6B6B" size="2">&nbsp;Email Address</font></td> <td><input class='field' type='text' size='40' maxlength="50" name='email' value='<?=$account->email ?>'> <span class='requiredField'>&nbsp;*&nbsp;</span><span class='errorMessage'><?=$account->get_error('email') ?></span></td> </tr> 
    
    <tr> <td class='fieldLabel'><font face="Arial" color="#6B6B6B" size="2">&nbsp;Address</font></td> <td><input class='field' type='text' size='40' maxlength="70" name='address' value='<?=$account->address ?>'> <span class='requiredField'>&nbsp;*&nbsp;</span><span class='errorMessage'><?=$account->get_error('address') ?></span></td> </tr> 
    
    <tr> <td class='fieldLabel'><font face="Arial" color="#6B6B6B" size="2">&nbsp;Address 2</font></td> <td><input class='field' type='text' size='40' maxlength="70" name='address_second' value='<?=$account->address_second ?>'></td>  </tr> 
    
    <tr> <td class='fieldLabel'><font face="Arial" color="#6B6B6B" size="2">&nbsp;City</font></td> <td><input class='field' type='text' size='40' maxlength="50" name='city' value='<?=$account->city ?>'> <span class='requiredField'>&nbsp;*&nbsp;</span><span class='errorMessage'><?=$account->get_error('city') ?></span></td> </tr>  
    
    <tr> <td class='fieldLabel'><font face="Arial" color="#6B6B6B" size="2">&nbsp;State/Province</font></td> <td><input class='field' type='text' size='35' maxlength="35" name='phone' value='<?=$account->phone ?>'>&nbsp;*&nbsp;</td> </tr>
    
    <tr> <td class='fieldLabel'><font face="Arial" color="#6B6B6B" size="2">&nbsp;Zip/Postal Code</font></td> <td><input class='field' type='text' size='35' maxlength="35" name='zip_postal_code' value='<?=$account->zip_code ?>'> <span class='requiredField'>&nbsp;*&nbsp; </span><span class='errorMessage'><?=$account->get_error('zip_code') ?></span></td> </tr>
    
    <tr> <td class='fieldLabel'><font face="Arial" color="#6B6B6B" size="2">&nbsp;Country</font></td> <td><input class='field' type='text' size='35' maxlength="35" name='mobile_phone_number' value='<?=$account->mobile_phone_number ?>'>&nbsp;*&nbsp;</td></tr>
    
    <tr><td>&nbsp;</td></tr><tr><td colspan="2" class='hLine' align="right"><span class='requiredField'>&nbsp;*</span><font face="Arial" color="#000000" size="2">&nbsp;&nbsp; Required Field</font></td></tr> <tr><td colspan='2' align="right"><input class='button' type='submit' value='create'></td></tr><tr><td colspan="2">&nbsp;</td></tr> </table> </form>

  2. #2
    SitePoint Evangelist optl's Avatar
    Join Date
    Oct 2004
    Location
    Washington DC
    Posts
    415
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just add a checkbox <input name="terms" type="checkbox" value="1">

    On the validation page:
    PHP Code:
    if ($_POST[terms] != 1) {
       
    // You must agree to terms...

    For the phrase "Bethesda home architect", my clients
    websites occupy 6 of the first 8 results
    on the 1st page of Google. My Secret SEO Strategy Revealed

  3. #3
    Non-Member
    Join Date
    Apr 2007
    Posts
    224
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thanks...

    Thanks for your reply. Sorry that I need some clarification.

    You're saying add this:

    <input name="terms" type="checkbox" value="1">

    to the form page (that I displayed here)?



    And add this:

    if ($_POST[terms] != 1) { // You must agree to terms...}

    to the validation page?

    How can I find the validation page?


    Thanks.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •