Beginner! Cannotmodifyheaderinformation... Related issues

Source: Internet
Author: User
Beginner !! Cannotmodifyheaderinformation... I want to use PHPcontactform to create an inquirypage, so that you can enter your name, phone number, email, etc, press "send" to send the above information to my mailbox, but I am a newbie... The entire co is a beginner !! Cannot modify header information... Problem TAT
I want to use PHP contact form to create an inquiry page, so that people can fill in the name, phone number, email, etc. press "send" and the above information will be sent to my mail box by email.

But I'm a newbie... The entire contact form is basically used to copy and modify the network to teach: http://myphpform.com/php-form-tutorial.php

After "send" is pressed, I want to jump to the thank you page, but "Cannot modify header information-header already sent by (output started at C: \ inetpub \ wwwroot \ contant2.php: 1) in C: \ inetpub \ wwwroot \ contant2.php on line 34"

* Line34 = header ('Location: ThankYou.html ');

I found a solution and tried it.
1. Add exit () after the header ();
2. add And ob_end_flush ();

Finally, an email can be sent successfully. Any omission in the information will jump to the error page, but it is impossible to go to the thank you page... Cannot modify header information (omitted)

Is there an error in the place where I add exit/ob_start? Is there any other problem?
Please take a look> <"

The following code is used:

P.S. I used notepad for this php file.

PHP code
  
  
              Order form error            
      
   Please correct the following error:
   






------ Solution --------------------
Discussion

Oh... sorry, that blank line is the one that slides and presses when posting...

------ Solution --------------------
Check whether the file has a bom header. If yes, remove it.
Add ob_clean () to header ('Location: ThankYou.html ');.
------ Solution --------------------
In addition to On, you also need to set the display level.
Error_reporting (E_ALL );

Discussion

I changed the header line
// Header ('Location: ThankYou.html ');
Then, display_errors = On is changed in php. ini.
Is that correct?

(I am not using apache but IIS) after restarting... the browser shows a blank space ......

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.