ok i have some code and i need to find out how to do a few things, first of all, i cant post it on here cause for some reason the snippet are wrong and im not sure how to go about swappin everything out so im going to post a link to it on yahoo answers as the question and someone put an answer but it did not help me. im not sure if thats ok as this is my first time using this site but i really have been struggling for a few days with this

what i need to do is this is a registration page and when users hit submit button I would like for this to not only SUBMIT the information but also REDIRECT the page to my home page.

and the same thing goes for a login page if anyone can code one for me That'd be beyond helpful.

CODE HERE

Recommended Answers

All 4 Replies

Hi,

Why don't you put a simple redirect like the one below in the page specified by "$editFormAction" variable?

header("Location: http://your-homepage.example.com/");

Note: header changes, and the line above of course, should be ordered before submitting any output to the client.

Eh diamonds, as im rather new to this whole deal, I could use a bit more specificity on what exactly you're saying.

Because so far i tried a few suggestions and while one did not work at all, the other simply made my registration page useless as it made it refresh every time someone clicked on the link

This is what i've added to the end While this Does in fact redirect the page, its on a timer, and i want it to be AFTER the form has been submitted, not after a certain amount of time.

Also the timer just refreshes the page, it does not actually SUBMIT the form data

<?php

$redirectPage = '';

if( headers_sent() ){
     echo '<meta http-equiv="refresh" content="1;URL=\'http://www.eclips3gaming.com/' . $redirectPage . '\'" />';
}else{
     header('Location: ' . $redirectPage);
     exit;
}

?>

Ok, what you have is the redirect-code that you need to put in the page you submit the data to.
For instance, you've used the following code in the registeration page:

<form id="form1" name="form1" method="POST" action="<?php echo $editFormAction; ?>">

The form data will be submitted to the page provided in the "action" parameter (which is the value of $editFormAction).

Suppose that ( $editFormAction = 'http://www.example.com/register.php?do=register'; )
Now you need to put your code in 'register.php' page something like the following:

<?php
/***
 * Page name: register.php
***/

    if (@$_GET['do'] === 'register')
    {
        // put data validation code here...

        // put the registeration code here...

        // put redirect-code here, you can use your code or the following code:
        $redirectPage = 'http://www.example.com/homepage.php';
        header ("Location: $redirectPage");
    }

?>

Regards,

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.