Is there a php script to accept terms & conditions

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • camphor
    New Member
    • Sep 2006
    • 35

    Is there a php script to accept terms & conditions

    hi,

    would anyone know if there is a php script to Accept the Terms & Conditions. The customer must check the Terms & Conditions box before he/she is able to go to the next page.
    Not really sure what this script would come under

    thanks
  • Lumpy
    New Member
    • Oct 2007
    • 69

    #2
    Originally posted by camphor
    hi,

    would anyone know if there is a php script to Accept the Terms & Conditions. The customer must check the Terms & Conditions box before he/she is able to go to the next page.
    Not really sure what this script would come under

    thanks

    If your looking just to download the script from someone else than I would type "php script to Accept the Terms & Conditions" into Google and go from there. Plenty of sites like hotscripts.com come up and you can search through what they have and go from there.

    Comment

    • pbmods
      Recognized Expert Expert
      • Apr 2007
      • 5821

      #3
      Heya, Camphor.

      On the page with the terms and conditions, add a checkbox:
      [code=html]
      <form method="post" action="..." >
      .
      .
      .
      <input type="checkbox" name="accept" /> Accept
      [/code]

      On the page that processes the form:
      [code=php]
      if( isset($_POST['accept']) )
      {
      // User accepted terms & conditions. Go to next page.
      }
      else
      {
      // User did not accept. Go back.
      }
      [/code]

      Comment

      • vladi
        New Member
        • Nov 2007
        • 2

        #4
        mix with javascripting helping...

        Try this
        mixing with javascripting under 'echo' helping...[code=php]
        <? php code here...
        echo "head<scrip t>


        var checkobj

        function agreesubmit(el) {
        checkobj=el
        if (document.all|| document.getEle mentById){
        for (i=0;i<checkobj .form.length;i+ +){ //hunt down submit button
        var tempobj=checkob j.form.elements[i]
        if(tempobj.type .toLowerCase()= ="submit")
        tempobj.disable d=!checkobj.che cked
        }
        }
        }

        function defaultagree(el ){
        if (!document.all& &!document.getE lementById){
        if (window.checkob j&&checkobj.che cked)
        return true
        else{
        alert("Please read/accept terms to submit form")
        return false
        }
        }
        }

        </script>head
        body<form name="agreeform " onSubmit="retur n defaultagree(th is)">
        Rest of your form here<br>
        <input name="agreechec k" type="checkbox" onClick="agrees ubmit(this)"><b >I agree to the above terms</b><br>
        <input type="Submit" value="Submit!" disabled>
        </form>

        <script>
        //change two names below to your form's names
        document.forms. agreeform.agree check.checked=f alse
        </script>

        <p align="center"> <font face="Arial" size="-2">Free DHTML scripts provided by<br>
        <a href="http://www.thescripts. com">You sign!</a></font></p>body";
        ?>[/code]
        before any["] put this [\] will be look-> echo "<head> \"text\" and etc. but not first and last - did you know...!!!
        thanks
        you is now free...
        Last edited by pbmods; Nov 28 '07, 02:36 PM. Reason: Added CODE tags.

        Comment

        • camphor
          New Member
          • Sep 2006
          • 35

          #5
          thank you all for your reply, will try the scripts out

          Comment

          • camphor
            New Member
            • Sep 2006
            • 35

            #6
            Originally posted by pbmods
            Heya, Camphor.

            On the page with the terms and conditions, add a checkbox:
            [code=html]
            <form method="post" action="..." >
            .
            .
            .
            <input type="checkbox" name="accept" /> Accept
            [/code]

            On the page that processes the form:
            [code=php]
            if( isset($_POST['accept']) )
            {
            // User accepted terms & conditions. Go to next page.
            }
            else
            {
            // User did not accept. Go back.
            }
            [/code]
            Hi pbmods,

            I tried the code out but it doesn't seem to work and I don't know why, I am a newbie in php, this is what I did
            Code:
            <?php 
            
                  if( isset($_POST['accept']) )
             
                  {
              
                      // User accepted terms & conditions.  Go to next page.
            
                  }
            
                  else
              
                  {
              
                      // User did not accept.  Go back.
            
                  }
            ?>
            <form method="post" action="">
            		
            <p class="booking"><input type="checkbox" id="cust_agree" name="accept" />&nbsp;I accept the <a href="terms.php">Terms and Conditions</a></p>	
            
            <p>If you wish to place an order, please accept the <a href="terms.php">Terms and Conditions </a>by checking<br />
              the box. We reserve the right to refuse any order at our sole discretion and will refund<br /> the fee</p>
            This is what I want to happen, the customer clicks on a' Package' and before the customer can go to the cart page they must accept the terms and conditions.
            This is the link to the page http://www.photorestorationexpert.co.uk/order/index.php
            thanks

            Comment

            • pbmods
              Recognized Expert Expert
              • Apr 2007
              • 5821

              #7
              Heya, camphor.

              In your case, you'll probably want to do something like this:

              [code=php]
              if( isset($_POST['accept']) )
              {

              // User accepted terms & conditions. Go to next page.
              header('Locatio n: cart.php'); // (or whatever the cart page is called)
              }
              else
              {

              // User did not accept. Go back.
              echo '<div>You must agree to the terms and conditions to continue.'</div>
              }
              [/code]

              Comment

              • camphor
                New Member
                • Sep 2006
                • 35

                #8
                Originally posted by pbmods
                Heya, camphor.

                In your case, you'll probably want to do something like this:

                [code=php]
                if( isset($_POST['accept']) )
                {

                // User accepted terms & conditions. Go to next page.
                header('Locatio n: cart.php'); // (or whatever the cart page is called)
                }
                else
                {

                // User did not accept. Go back.
                echo '<div>You must agree to the terms and conditions to continue.'</div>
                }
                [/code]
                pbmods,

                I used the code and got this error message instead:
                Parse error: syntax error, unexpected '<' in /home/photores/public_html/order/index.php on line 124

                this is line 124
                Code:
                <?php 
                      if( isset($_POST['accept']) )
                            {   
                          // User accepted terms & conditions.  Go to next page.
                          header('Location: cart.php'); // (or whatever the cart page is called)
                            }
                            else
                            {
                          // User did not accept.  Go back.
                 (line 124) [B]echo <div>'You must agree to the terms and conditions to continue.'</div>[/B]
                            }
                ?>
                <form method="post" action="">
                		
                <p class="booking"><input type="checkbox" id="cust_agree" name="accept" />&nbsp;I accept the <a href="terms.php">Terms and Conditions</a></p>
                I tried fixing it but wasn't really sure what I was doing

                thanks

                Comment

                • Markus
                  Recognized Expert Expert
                  • Jun 2007
                  • 6092

                  #9
                  The single qoutes - line 124 - need to be before the first <DIV> and after the last <DIV>.

                  Good day.

                  :)

                  Comment

                  • camphor
                    New Member
                    • Sep 2006
                    • 35

                    #10
                    Originally posted by markusn00b
                    The single qoutes - line 124 - need to be before the first <DIV> and after the last <DIV>.

                    Good day.

                    :)
                    markusn00b,

                    thanks for that.

                    This is what I want to happen, the customer clicks on a' Package' and before the customer can go to the cart page they must first accept the terms and conditions.
                    This is the link to the page http://www.photorestor ationexpert.co. uk/order/index.php
                    I tried the code that pbmods gave me but it still goes to the cart page without the customer accepting the terms and conditions first, which I want to happen
                    thanks

                    Comment

                    • Markus
                      Recognized Expert Expert
                      • Jun 2007
                      • 6092

                      #11
                      http://www.photorestor ationexpert.co. uk/order/index.php

                      Is that ^^^^ the page in question?

                      And also, do you want to check that the box has been checked when the 'click to order' button has been pressed?

                      merry christmas
                      :)

                      Comment

                      • camphor
                        New Member
                        • Sep 2006
                        • 35

                        #12
                        Originally posted by markusn00b
                        http://www.photorestor ationexpert.co. uk/order/index.php

                        Is that ^^^^ the page in question?

                        And also, do you want to check that the box has been checked when the 'click to order' button has been pressed?

                        merry christmas
                        :)
                        That is the page in question and I also want to check that the box (terms & conditions) has been checked when the 'click to order' button has been pressed?
                        In other words, yes to the above 2 questions
                        happy new year :-)

                        Comment

                        • Markus
                          Recognized Expert Expert
                          • Jun 2007
                          • 6092

                          #13
                          [code=javascript]
                          <script type="text/javascript">
                          function checkTerms(){
                          var checkBox = document.termsA ndConditions.ac cept;
                          if(!checkBox.ch ecked){
                          alert("You must accept our terms and conditions");
                          window.location = "http://www.photorestor ationexpert.co. uk/order/index.php#terms AndConditions";
                          return false;
                          } else {
                          return true;
                          }
                          }
                          </script>
                          [/code]
                          First we assign the checkBox variable to the checkbox in the form.
                          Then we check (through onclick - coming later) whether the if statement returns true or false; if it returns false, we alert them and scroll the page down to the terms and conditions*, then we return false - so the href="" doesnt execute.
                          If the if statamen returns true; the checkbox was checked so carry on.
                          [code=html]
                          <form id="termsAndCon ditions" name="termsAndC onditions">
                          <input type="checkbox" name="accept" />
                          </form>
                          <a href="order.htm l..." onclick="checkT erms()">Click here to order</a>
                          [/html]
                          The html.. you'll have to adapt this to your code.

                          *To have the page scroll down to the terms and conditions you'll have to assign an ID to it. Then you can pass that id into the url and it will automatically scroll down to that section.

                          Hope this helps :)

                          Comment

                          • camphor
                            New Member
                            • Sep 2006
                            • 35

                            #14
                            hi markusn00b,

                            I am finding this very frustrating as the php/html bit is not working when I try to test the order page, I have very little knowledge of javascript but I understand your explanation, for the php/html code, would this be correct
                            Code:
                             
                            Package 4&nbsp; £30
                            <div id="service1">
                            	<ul>
                            	<li>Removal of scratches from face, hand or other complex areas</li>
                            	<li>Teeth whitening</li>
                            	<li>Merging two or more photos together</li>
                            	<li>Color correction of large faded areas</li>
                            	<li>Repair of tears</li>
                            	<li>Repair of creases</li>
                            	</ul></div>
                            <a href='<?php ProductBuyLink(11); ?>' [B]onclick="checkTerms()"[/B]><img src="../images/click-toorder.png" class="clickToOrderBtn" width="80" height="15" border="0" alt="order button" /></a></div>
                            CSS

                            .clickToOrderBt n {
                            margin-left:85%;
                            }

                            #service1 {
                            margin:0;
                            font-size:1.1em;
                            }

                            #service1 ul {
                            font-size:1.0em;
                            font-family:"Century Gothic";
                            }

                            #service1 li {
                            list-style-type:disc;
                            margin-left:5%;
                            font-size:1.0em;
                            }


                            I am using php as the shopping cart I am using uses php. I am using an image for the click here to order, so would the bold bit be correct

                            thanks once again and your help is much appreciated

                            Comment

                            Working...