Results 1 to 10 of 10
  1. #1

    Question on Forms

    Hi there,

    I have created a "terms and conditions" form using a script for my website. I have named this form register1.php. Once users agree to terms, the get redirected to register2.php where they need to fill out their name, details,etc.

    The problem that I'm having is that if users just type mywebsitename/register2.php, they get send directly to the registration page totally bypassing the "terms and conditions" (register1.php) form and I don't want that.

    What can I add or what can I do to deny people access to register2.php if they haven't agreed to register1.php?(terms and conditions) maybe add a message saying that they need to agree to register1.php befoe gainning access to register2.php?


    Thanks

  2. #2
    Join Date
    Sep 2004
    Location
    Flint, Michigan
    Posts
    5,765
    This would probably fit better in the programming area, but in any event I would do it with a simple form.

    ie.

    Form on register1.php posts to register2.php with a checkbox for agreeing to the terms and conditions.

    On register2.php do something like
    PHP Code:
    <?php
    if(!$_POST['agree'] == 'true') {
    header('location:register1.php');
    } else { 
    ?>

    Page stuff here

    <?php ?>
    Mike from Zoodia.com
    Professional web design and development services.
    In need of a fresh hosting design? See what premade designs we have in stock!
    Web design tips, tricks, and more at MichaelPruitt.com

  3. #3
    hello,

    thanks for that. Not sure in what part of the page to add the code, I keep getting error messages

  4. #4
    Join Date
    Sep 2004
    Location
    Flint, Michigan
    Posts
    5,765
    Should be at the very top. Which error message is it throwing you? Headers already started?
    Mike from Zoodia.com
    Professional web design and development services.
    In need of a fresh hosting design? See what premade designs we have in stock!
    Web design tips, tricks, and more at MichaelPruitt.com

  5. #5
    Join Date
    Jun 2001
    Location
    Kalamazoo
    Posts
    33,190
    Moved to 'Programming Discussion.'
    There is no best host. There is only the host that's best for you.

  6. #6
    Yes, you right. headers already started.

    Warning: Cannot modify header information - headers already sent by (output started at c:\wamp\www\alcohol\register2.php:2) in c:\wamp\www\alcohol\register2.php on line 4


    I can post the full code of the page if that will help

  7. #7
    Join Date
    Sep 2004
    Location
    Flint, Michigan
    Posts
    5,765
    Sure wouldn't hurt

    Just make sure that code is at the very top without any whitespace before it and it should work.
    Mike from Zoodia.com
    Professional web design and development services.
    In need of a fresh hosting design? See what premade designs we have in stock!
    Web design tips, tricks, and more at MichaelPruitt.com

  8. #8
    Hi,

    I moved the code to the top of the page like you said. Not getting error messages anymore but what happens is that once someone click the 'accept box' and hit continue, the page instead of going to register2.php to continue the registration, goes back to register1.php

  9. #9
    Join Date
    Sep 2004
    Location
    Flint, Michigan
    Posts
    5,765
    Well you have to set the form up properly.

    Code:
    <form name="tosagree" method="post" action="register2.php">
    <input name="agree" type="checkbox" id="agree" value="true">
    <input type="submit" name="Submit" value="Submit">
    </form>
    Mike from Zoodia.com
    Professional web design and development services.
    In need of a fresh hosting design? See what premade designs we have in stock!
    Web design tips, tricks, and more at MichaelPruitt.com

  10. #10
    I made a couple of changes to the script I already had and combine with the one you gave me, seems like is working fine. Thanks for that!

    Do you know anything about billing? (like billing users for services)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •