Help - Search - Members - Calendar
Full Version: [PHP] - [Terms Of Service] - [Gio]
Pixel2Life Forum > Member Tutorials and Requests > Forum Tutorial Archives > PHP Tutorials
Gio
Ok this is not the most requested tutorial ever, but it is a neat feature to have and use for a registration script or a download script. Anyways, lets look at the code.

Ok first let's show the php behind the form, then we will see the code for the form.

Accept.php

CODE
<?php
if ($choose == "yes")
// If they do accept..
{
include("accepted.html");
}
// Include the page
else
// If they do not accept..
{
print("Sorry, you abide by the terms!");
}
// Print the message
?>


Ok the first part if ($choose == "yes")
What this is doing is if the user chooses to abide by your terms, they will be redirected to accepted.html or what ever you choose to name the file.
Then we have an else statement if they choose no they get a message that sais you must abide by the terms.
Now for the form.

TOS.html

CODE
<form action="accept.php" method="post">
<textarea name="terms">Your tos go here.</textarea><br>
Do you accept these terms?
<input type="radio" name="choose" value="yes">Yes
<input type="radio" name="choose" value="radiobutton">No<br>
<input type="submit" name="Submit" value="Next">
</form>


Ok first we tell the form what file is doing the processing, then what method are we getting the data. Then you put your terms of service after the <textarea name="terms"> then you give the user 2 options yes or no. Then The submit button which will send the data through accept.php and send them to accepted.html or echo the error message.

Well hope you use this, and post any comments you have on this short tutorial. I welcome all comments/criticism.
Jaymz
Nice tut smile.gif
Jay
i prefer the javascript method of not letting them by until they've checked the box tongue.gif makes them have to agree to terms

but this would be fun if you wanted a special flash movie or something to appear when they didnt agree smile.gif
Gio
Glad to help bigwink.gif
Anarchy
i like your tuts, very practical victory.gif
Gio
Very small is more like it, I am unloading all my small tutorials, before my new site comes out. Then we get the big ones done bigwink.gif
Unreal
hehhe this is cool thanks happy.gif
Gio
QUOTE(Unreal @ Sep 6 2004, 04:57 PM)
hehhe this is cool thanks happy.gif

No problem.
stingerblue
I might add this on my web sites
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.