agree the terms and condition script

This is a discussion on "agree the terms and condition script" within the PHP Forum section. This forum, and the thread "agree the terms and condition script are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Apr 13th, 2007, 00:31
Up'n'Coming Member
Join Date: Jul 2006
Location: manila
Age: 28
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
agree the terms and condition script

hello,

need help, can you give me example php script on how to check and agree the terms and condition in the sign up form.

thanks..

csun
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Apr 13th, 2007, 08:05
Junior Member
Join Date: Apr 2007
Location: Gloucester, UK
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Re: agree the terms and condition script

Mmm, you might be better doing this with Javascript. It would be more instantaneous and you wouldn't have to pass any variables back to the page.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Apr 13th, 2007, 08:37
Up'n'Coming Member
Join Date: Jul 2006
Location: manila
Age: 28
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Re: agree the terms and condition script

thanks for the response, can you give me a link on this javascript..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Apr 13th, 2007, 11:59
Junior Member
Join Date: Apr 2007
Location: Gloucester, UK
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Re: agree the terms and condition script

there's a thing about Javascript form validation here: http://www.w3schools.com/js/js_form_validation.asp
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Apr 13th, 2007, 13:19
Reputable Member
Join Date: May 2006
Location: Northampton, UK
Posts: 399
Thanks: 0
Thanked 0 Times in 0 Posts
Re: agree the terms and condition script

in case you decide to do this with php heres the logic behind it.

1) tick box to aggree to terms and conditions "posts" value "terms" to your php script.

2) vale $_POST['terms'] is set = to $terms

3) php script checks to see if the variable $terms is set to 1. if it is then the rest of the script is processed/

4) if not set a $_SESSION['terms_error'] and pass it back to the main page using the header() function.

5) once back on the main page chck to see if $_SESSION['terms_error'] isset and if it is you echo out "you must aggree to the terms and conditions"


heres some code that should do what you want... it might need some modification as this is off the top of my head... if u have any problems ill try and fix it.

ok here is the page containing the form that allows people to register. Note that it also contains some php if else statement.... but we shall come back to those later.

Code: Select all
<?php
if(isset isset($_SESSION['terms_error']))
{
@$terms_error = $_SESSION['terms_error'];

if ($terms_error != ""){
echo "<h4>Registration Error</h4>";
echo "<strong>You must aggree to the terms and conditions, Please try again.</strong>";
$_SESSION['terms_error'] = "";
}
}
?>

<form method="POST" action="adduser.php">
Desired User Name<input type="text" name="username" size="30" maxlength="25" />
Desired Password<input type="password" name="password" size="30" maxlength="25" />
I aggree to the Terms & Conditions <input name="terms" type="checkbox" />
<input type="submit" name="submit" value="Join Now" />
</form>
I havnt include all of the neccessary html headers and tags.. body etc... so ull have to slot the above into an existing document, or add those bits seperatly.

ok, now, heres the php file that processes the registration

Code: Select all
<?php
$username = $_POST['username'];
$password = $_POST['password'];
$terms = $_POST['terms'];

if ($terms != "on") {
$_SESSION['terms_error'] = "1";
header("location: registration.php");
}
else {

// Add the info to the database... send emails... whatever in there... or even perform more checks on passwords etc.


}//if terms are aggreed if
?>
hope that makes sense

notice the headers sending back to the first page if the terms were not aggreed.... any problems let me know

Last edited by Accurax; Apr 13th, 2007 at 13:37.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Apr 14th, 2007, 20:26
Ryan Fait's Avatar
Elite Veteran
Join Date: May 2006
Location: Las Vegas
Posts: 3,787
Thanks: 0
Thanked 0 Times in 0 Posts
Re: agree the terms and condition script

I'd say do it with both PHP and JavaScript.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Apr 15th, 2007, 02:23
Up'n'Coming Member
Join Date: Jul 2006
Location: manila
Age: 28
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Re: agree the terms and condition script

thank you for the response i really appreciate it.. It really helps me here..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Apr 16th, 2007, 08:17
Reputable Member
Join Date: May 2006
Location: Northampton, UK
Posts: 399
Thanks: 0
Thanked 0 Times in 0 Posts
Re: agree the terms and condition script

Advantage of using JS is that you can keep the fields filled in even afetr the error has been passed .... so mabye a combination is best.

I havnt found a way to refill the fields after moving the user back to the form, but then a signup form should only be a small afair.

If anyone knows how to do this without the use of JS id really appreciate the info.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old Apr 17th, 2007, 11:36
Junior Member
Join Date: Apr 2007
Location: Gloucester, UK
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Re: agree the terms and condition script

I know

Well this is what I use anyway. Without giving you a load of code, I'll just go through the process I use.

Code: Select all
<form name="form" method="post" action="contact.php">
in the head of the document you detect whether the form has been submitted.

PHP: Select all

if(isset($_POST['name'])) 

then you do the tests to make sure the form is valid, however you want to do that. Then if the form is valid, perform whatever process you want and exit() the page.

Now, below that, of course, would be the form. You'd only exit the page if the code is valid. If not the form is displayed again and you can use code like:

PHP: Select all

<input id="name" name="name" class="boxes" type="text" <?php if(isset($_POST['name'])){echo 'value="'.$_POST['name'].'"';}?> />
... to display the returned form data and set up a query string that tells the user what the problem is.

It's not the most elegant solution I'm sure, but it works rather well.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10  
Old Apr 18th, 2007, 08:27
Reputable Member
Join Date: May 2006
Location: Northampton, UK
Posts: 399
Thanks: 0
Thanked 0 Times in 0 Posts
Re: agree the terms and condition script

yeah that would work ..... dont know why i didnt think of it myself... thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #11  
Old Apr 18th, 2007, 17:21
Junior Member
Join Date: Apr 2007
Location: Gloucester, UK
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Re: agree the terms and condition script

To be honest, it's something I struggled with myself for ages, coming up with more and more complex solutions for it that never seamed to work correctly. I suppose the solution is just to go back to basic principals and write down what you want to do and in what order.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
terms and condition

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Condition on button action artdog Flash & Multimedia Forum 1 Sep 14th, 2006 19:45
£49 to transfer out!!! Do you agree?? christopher Hosting & Domains 7 May 20th, 2006 11:59
Tempted to agree... timmytots Web Page Design 16 Dec 3rd, 2005 19:37


All times are GMT. The time now is 09:57.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42