By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,474 Members | 3,139 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,474 IT Pros & Developers. It's quick & easy.

Is there a php script to accept terms & conditions

P: 35
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
Nov 27 '07 #1
Share this Question
Share on Google+
13 Replies


P: 69
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.
Nov 27 '07 #2

pbmods
Expert 5K+
P: 5,821
Heya, Camphor.

On the page with the terms and conditions, add a checkbox:
Expand|Select|Wrap|Line Numbers
  1. <form method="post" action="..." >
  2.     .
  3.     .
  4.     .
  5.     <input type="checkbox" name="accept" /> Accept
  6.  
On the page that processes the form:
Expand|Select|Wrap|Line Numbers
  1. if( isset($_POST['accept']) )
  2. {
  3.     // User accepted terms & conditions.  Go to next page.
  4. }
  5. else
  6. {
  7.     // User did not accept.  Go back.
  8. }
  9.  
Nov 27 '07 #3

P: 2
Try this
mixing with javascripting under 'echo' helping...
Expand|Select|Wrap|Line Numbers
  1. <? php code here...
  2. echo "head<script>
  3.  
  4.  
  5. var checkobj
  6.  
  7. function agreesubmit(el){
  8. checkobj=el
  9. if (document.all||document.getElementById){
  10. for (i=0;i<checkobj.form.length;i++){  //hunt down submit button
  11. var tempobj=checkobj.form.elements[i]
  12. if(tempobj.type.toLowerCase()=="submit")
  13. tempobj.disabled=!checkobj.checked
  14. }
  15. }
  16. }
  17.  
  18. function defaultagree(el){
  19. if (!document.all&&!document.getElementById){
  20. if (window.checkobj&&checkobj.checked)
  21. return true
  22. else{
  23. alert("Please read/accept terms to submit form")
  24. return false
  25. }
  26. }
  27. }
  28.  
  29. </script>head
  30. body<form name="agreeform" onSubmit="return defaultagree(this)">
  31. Rest of your form here<br>
  32. <input name="agreecheck" type="checkbox" onClick="agreesubmit(this)"><b>I agree to the above terms</b><br>
  33. <input type="Submit" value="Submit!" disabled>
  34. </form>
  35.  
  36. <script>
  37. //change two names below to your form's names
  38. document.forms.agreeform.agreecheck.checked=false
  39. </script>
  40.  
  41. <p align="center"><font face="Arial" size="-2">Free DHTML scripts provided by<br>
  42. <a href="http://www.thescripts.com">You sign!</a></font></p>body";
  43. ?>
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...
Nov 28 '07 #4

P: 35
thank you all for your reply, will try the scripts out
Nov 28 '07 #5

P: 35
Heya, Camphor.

On the page with the terms and conditions, add a checkbox:
Expand|Select|Wrap|Line Numbers
  1. <form method="post" action="..." >
  2.     .
  3.     .
  4.     .
  5.     <input type="checkbox" name="accept" /> Accept
  6.  
On the page that processes the form:
Expand|Select|Wrap|Line Numbers
  1. if( isset($_POST['accept']) )
  2. {
  3.     // User accepted terms & conditions.  Go to next page.
  4. }
  5. else
  6. {
  7.     // User did not accept.  Go back.
  8. }
  9.  
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
Expand|Select|Wrap|Line Numbers
  1. <?php 
  2.  
  3.       if( isset($_POST['accept']) )
  4.  
  5.       {
  6.  
  7.           // User accepted terms & conditions.  Go to next page.
  8.  
  9.       }
  10.  
  11.       else
  12.  
  13.       {
  14.  
  15.           // User did not accept.  Go back.
  16.  
  17.       }
  18. ?>
  19. <form method="post" action="">
  20.  
  21. <p class="booking"><input type="checkbox" id="cust_agree" name="accept" />&nbsp;I accept the <a href="terms.php">Terms and Conditions</a></p>    
  22.  
  23. <p>If you wish to place an order, please accept the <a href="terms.php">Terms and Conditions </a>by checking<br />
  24.   the box. We reserve the right to refuse any order at our sole discretion and will refund<br /> the fee</p>
  25.  
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
Dec 12 '07 #6

pbmods
Expert 5K+
P: 5,821
Heya, camphor.

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

Expand|Select|Wrap|Line Numbers
  1. if( isset($_POST['accept']) )
  2.       {
  3.  
  4.           // User accepted terms & conditions.  Go to next page.
  5.           header('Location: cart.php'); // (or whatever the cart page is called)
  6.       }
  7.       else
  8.       {
  9.  
  10.           // User did not accept.  Go back.
  11.           echo '<div>You must agree to the terms and conditions to continue.'</div>
  12.       }
  13.  
Dec 14 '07 #7

P: 35
Heya, camphor.

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

Expand|Select|Wrap|Line Numbers
  1. if( isset($_POST['accept']) )
  2.       {
  3.  
  4.           // User accepted terms & conditions.  Go to next page.
  5.           header('Location: cart.php'); // (or whatever the cart page is called)
  6.       }
  7.       else
  8.       {
  9.  
  10.           // User did not accept.  Go back.
  11.           echo '<div>You must agree to the terms and conditions to continue.'</div>
  12.       }
  13.  
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
Expand|Select|Wrap|Line Numbers
  1. <?php 
  2.       if( isset($_POST['accept']) )
  3.             {   
  4.           // User accepted terms & conditions.  Go to next page.
  5.           header('Location: cart.php'); // (or whatever the cart page is called)
  6.             }
  7.             else
  8.             {
  9.           // User did not accept.  Go back.
  10.  (line 124) echo <div>'You must agree to the terms and conditions to continue.'</div>
  11.             }
  12. ?>
  13. <form method="post" action="">
  14.  
  15. <p class="booking"><input type="checkbox" id="cust_agree" name="accept" />&nbsp;I accept the <a href="terms.php">Terms and Conditions</a></p>    
  16.  
I tried fixing it but wasn't really sure what I was doing

thanks
Dec 21 '07 #8

Markus
Expert 5K+
P: 6,050
The single qoutes - line 124 - need to be before the first <DIV> and after the last <DIV>.

Good day.

:)
Dec 21 '07 #9

P: 35
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.photorestorationexpert.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
Dec 24 '07 #10

Markus
Expert 5K+
P: 6,050
http://www.photorestorationexpert.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
:)
Dec 24 '07 #11

P: 35
http://www.photorestorationexpert.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 :-)
Jan 2 '08 #12

Markus
Expert 5K+
P: 6,050
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. function checkTerms(){
  3.     var checkBox = document.termsAndConditions.accept;
  4.     if(!checkBox.checked){
  5.         alert("You must accept our terms and conditions");
  6.         window.location = "http://www.photorestorationexpert.co.uk/order/index.php#termsAndConditions";
  7.         return false;
  8.     } else {
  9.         return true;
  10.     }
  11. }
  12. </script>
  13.  
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="termsAndConditions" name="termsAndConditions">
<input type="checkbox" name="accept" />
</form>
<a href="order.html..." onclick="checkTerms()">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 :)
Jan 2 '08 #13

P: 35
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
Expand|Select|Wrap|Line Numbers
  1.  
  2. Package 4&nbsp; 30
  3. <div id="service1">
  4.     <ul>
  5.     <li>Removal of scratches from face, hand or other complex areas</li>
  6.     <li>Teeth whitening</li>
  7.     <li>Merging two or more photos together</li>
  8.     <li>Color correction of large faded areas</li>
  9.     <li>Repair of tears</li>
  10.     <li>Repair of creases</li>
  11.     </ul></div>
  12. <a href='<?php ProductBuyLink(11); ?>' onclick="checkTerms()"><img src="../images/click-toorder.png" class="clickToOrderBtn" width="80" height="15" border="0" alt="order button" /></a></div>
  13.  
CSS

.clickToOrderBtn {
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
Jan 10 '08 #14

Post your reply

Sign in to post your reply or Sign up for a free account.