Jump to content

Recommended Posts

if only you wants to move to next page after hitting submit you can use headers

 

like:

 

if(isset($_POST['submit'])) {
//process datbase and use some statement if all goes well move to next page,
// and if you need those variables in your next page you can use sessions  
header('Location: nextpage.php')
}

I'm using a session on the same page so I can't use header, too bad..

??  you can use sessions and header() on the same page.  where'd you get that piece of information from?

 

I allways get this when I do that:

 

Warning: Cannot modify header information - headers already sent by (output started at /mail_send.php:10) in /mail_send.php on line 38

 

 

Hi,

 

For the below code.  Make sure that there is no code before header("Location: nextpage.php") that outputs any text or errors.  Also try putting the code above all html code on the page, basically the first lines on the page above the HEAD, TITLE, BODY DOCTYPE...

 

Also are you sure your mail_send.php is not outputting a message or error.  That would stop the header location from working potentially?

 

if(isset($_POST['submit']))
{
    // PROCESS DATA POST TO DB e.g. execute function here...
    if(!mysql_error())
    {
       header('Location: nextpage.php');
    }
}
else
{
   //do the funky chicken
}

 

I allways get this when I do that:

 

Warning: Cannot modify header information - headers already sent by (output started at /mail_send.php:10) in /mail_send.php on line 38

 

That error has nothing to do with sessions and a header() on the same page. It has to do with your code sending output before doing something that requires the use of a header - output started at /mail_send.php:10 (line 10)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.