steviez Posted February 14, 2007 Share Posted February 14, 2007 Hi, On my website when users signup i want them to have to click the "i agree to the terms of user" before they can signup. I have been trying for ages now and cant get it to work. How is this done? Thanks Quote Link to comment Share on other sites More sharing options...
Balmung-San Posted February 14, 2007 Share Posted February 14, 2007 You're going to have to be a bit more specific then that. There are a ton of ways to have an "I agree to ..." built in, it's a matter of what you're looking for. I know that phpBB puts up the ToS on a page, then for the agree link it sends you back to the same page with a variable attached to the back of the url, then in the page they check for the value, and output accordingly. Another common way is to have a checkbox at the bottom of your registration form. When they submit it you can then check whether or not it's checked. It all really depends on how you want to do it. Quote Link to comment Share on other sites More sharing options...
steviez Posted February 14, 2007 Author Share Posted February 14, 2007 I just want a check box on my signup page Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 14, 2007 Share Posted February 14, 2007 <input type="checkbox" name="terms" value="1"> I agree <input type="checkbox" name="terms" value="1" CHECKED> I agree <-- prechecked if(isset($_POST['terms']) && $_POST['terms'] == 1){ //they agreed. } Quote Link to comment Share on other sites More sharing options...
steviez Posted February 14, 2007 Author Share Posted February 14, 2007 It wont work for me. I just want it to validate if the user has checked it Quote Link to comment Share on other sites More sharing options...
Balmung-San Posted February 14, 2007 Share Posted February 14, 2007 It wont work for me. I just want it to validate if the user has checked it Explain "won't work". jesirose's code is a perfect example on how to do exactly what you want. Quote Link to comment Share on other sites More sharing options...
steviez Posted February 14, 2007 Author Share Posted February 14, 2007 If the box is not checked it still posts the form without an error or message saying "you must agree to our terms of use" Quote Link to comment Share on other sites More sharing options...
Balmung-San Posted February 14, 2007 Share Posted February 14, 2007 You'd need JavaScript. Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 14, 2007 Share Posted February 14, 2007 You need to do client side validation as WELL as javascript, but what you want is javascript. Quote Link to comment Share on other sites More sharing options...
steviez Posted February 14, 2007 Author Share Posted February 14, 2007 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.