www.webdeveloper.com
Results 1 to 7 of 7

Thread: I've to create a registration form that redirect to a page after registration

  1. #1
    Join Date
    Jan 2013
    Posts
    82

    Question I've to create a registration form that redirect to a page after registration

    Hi
    i've a page called registration.html that contains a form. I want that when the user click the "send" button, he will be redirected to the page called confirmRegistration.html
    ... But how to exlude the possibility of open this page writing manually the address into the address bar? (for exemple www.mysite.com/confirmRegistration.html)

    What approach you would use? Is it the case of use the SESSIONS?

  2. #2
    Join Date
    Aug 2012
    Posts
    155
    Your confirmRegistration page needs to be a .php, not a .html (unless you are making changes in htaccess) and then at the top of the page you would put something like this (difficult without your code):

    PHP Code:
    <?php
    if (!isset($_POST)) {
    header('location: name_of_page_to_redirect_to');
    } else {
    .
    .
    .
    // The form processing code here
    .
    .
    ?>

  3. #3
    Join Date
    Jan 2013
    Posts
    82
    uhmm,
    if !isset($_POST) it should return to the registration page with the form

    ELSE he should show the confirmation that is something like this.
    <div>You're successfully registred. Please Check your mail</div>

    In the php code can i put this html code after the ELSE? Note that i won't generate it trought php echo, but treat it such a normal html code

  4. #4
    Join Date
    May 2005
    Location
    Gold Coast (MS)
    Posts
    2,198
    This site will set it up very easy. Just plug in what is asked for in each step. Make sure you have the name of your files:

    http://www.thesitewizard.com/wizards/feedbackform.shtml


    PHP: Sending Email Tutorial (Text/HTML/Attachments): http://www.webcheatsheet.com/php/sen...attachment.php
    How to Code a Sign Up Form with Email Confirmation: http://net.tutsplus.com/tutorials/ph...-confirmation/

    CoffeeCup Free Web Form Builder (Win/Mac Versions): http://www.coffeecup.com/web-form-builder-lite/

  5. #5
    Join Date
    Jan 2013
    Posts
    82
    Quote Originally Posted by simplypixie View Post
    Your confirmRegistration page needs to be a .php, not a .html (unless you are making changes in htaccess) and then at the top of the page you would put something like this (difficult without your code):

    PHP Code:
    <?php
    if (!isset($_POST)) {
    header('location: name_of_page_to_redirect_to');
    } else {
    .
    .
    .
    // The form processing code here
    .
    .
    ?>
    Actually i've use your method, with the difference that the exact syntax is if (empty($_POST)), because the $_POST is a superglobal variable that is always set

    But now i don't know how to proceed.

    My php page is that:

    PHP Code:

    <?php

    if (empty($_POST))
    {
    header('location: loginPage.php');


    ?> 

    <div id="logo"> <img src=my_logo_small_grey.png  height="60"/> </div>
    <div id="msgConfirm">Thank You!</div>


    </body>
    But how to launch it passing a POST parameter? What method should i adopt? Actually i've tryied with AJAX ajaxReq.open("POST", url, true), but it don't open the page

  6. #6
    Join Date
    Aug 2012
    Posts
    155
    OK, I should have been a bit more specific regarding the isset (better to use than empty on its own) and I would normally have a hidden input field in my forms to check that the form has been posted, so something like
    PHP Code:
    if (!isset($_POST['confirm_login'])) {
    ...

    I am not 100% sure I understand your question but I think you are trying to pass a parameter back to the login page if the person is redirected (maybe an error code), so:

    PHP Code:
    if (!isset($_POST['confirm_login'])) {
      
    header('location: loginPage.php?error=1');

    I could help better if you could tell me exactly what information you want to send back to the login page on the header re-direct.

  7. #7
    Join Date
    Jan 2013
    Posts
    82
    yes this could be a solution

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles