Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > PHP FAQs
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
PHP FAQs This moderated forum is where our PHP experts answer some of the questions they see asked most frequently in the other PHP forums. You cannot post other messages here, use the other PHP forums for that.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP FAQs section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old March 20th, 2016, 09:28 AM
Authorized User
Points: 132, Level: 2
Points: 132, Level: 2 Points: 132, Level: 2 Points: 132, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2012
Posts: 25
Thanks: 3
Thanked 0 Times in 0 Posts
Question having trouble with header function

I am having trouble with using the header function. When a run my php script I get the following error: "Warning: Cannot modify header information - headers already sent by..." I read that there can be no output before the function call. I don't see anything wrong with my code. Any help would be apperciated.

Here is my code:
PHP Code:
session_start();
require_once(
'Test_Input.php');


if(!isset(
$_SESSION['Form_First_Name']) || !isset($_SESSION['Form_Last_Name']) || !isset($_SESSION['Form_Email']) || !isset($_SESSION['Form_Message']))
{
    
$_SESSION['Form_First_Name'] = '';
    
$_SESSION['Form_Last_Nameorm'] = '';
    
$_SESSION['Form_Email'] = '';
    
$_SESSION['Form_Message'] = '';



if(isset(
$_POST['Clear']) && $_POST['Clear'] == 'clear')
{
    
$_SESSION['Form_First_Name'] = '';
    
$_SESSION['Form_Last_Nameorm'] = '';
    
$_SESSION['Form_Email'] = '';
    
$_SESSION['Form_Message'] = '';
    unset(
$_SESSION['name_Switch']);
    unset(
$_SESSION['Form_Email_Switch']);
    
//header('location:Contact_Form.php');
}

$response $_POST['Response'];
$image_request $_POST['DB_Response'];
$first_name $_SESSION['Form_First_Name'] = $_POST['First_Name'];
$last_name $_SESSION['Form_Last_Name'] = $_POST['Last_Name'];
$email $_SESSION['Form_Email'] = $_POST['Email'];
$_SESSION['Form_Message'] = $_POST['Message'];


$first_name_result Test_Input::name_validation($first_name);
var_dump($first_name_result);
$last_name_result Test_Input::name_validation($last_name);
$email_result Test_Input::email_validation($email);

if(!
$first_name_result || !$last_name_result )
{
    
$_SESSION['Name_Switch'] = false;
    
header('location:Contact_Form.php');
}

if (!
$email_result)
{
    
$_SESSION['Form_Email_Switch'] = false;
    
header('location:Contact_Form.php');
}

if(
$response != $image_request)
{
     
    
//unset($_SESSION['Form_Switch']);
    
unset($_SESSION['Email_Switch']);
    
header('location:Contact_Form.php');
}

else 
{
    global 
$first_name;
    global 
$last_name;
    global 
$email;
    
$message 'FROM: '.$first_name.' '.$last_name.' \n\n'$_POST['Message'];
    
$to 'admin@showlove-productions.com';
    
$subject 'Show Love Production Contact Form';
    
$headers $email;
    
mail($to$subject$message$headers);
    
$_SESSION['Email_Switch'] = true;
    unset(
$_SESSION['Form_First_Name']);
    unset(
$_SESSION['Form_Last_Name']);
    unset(
$_SESSION['Form_Email']);
    unset(
$_SESSION['Form_Message']);
header('location:Contact_Form.php');

I mainly concerned why my header function calls are not working.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
trouble with format-date() function gib65 XSLT 3 March 12th, 2014 05:25 PM
VB2005 trouble returning structure from function MikeCS Visual Basic 2005 Basics 1 November 29th, 2006 06:45 PM
Header Function Problem. changusee2k PHP How-To 1 September 27th, 2006 02:45 AM
How to call javascript function from VB function vinod_yadav1919 VB How-To 0 February 13th, 2006 05:03 AM
trouble with header function trangd Beginning PHP 1 July 24th, 2004 06:01 PM



All times are GMT -4. The time now is 10:12 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.