Header Problem - dont understand PHP errors
Posted: Tue Aug 09, 2005 6:21 am
Ok I have got this header problem.
When I add a record in my form and press submit the file processpeople.php is loaded - this file consists of an insert statement which works perfectly fine and inserts my data, BUT at the bottom of the file I have a line of code which basically links to a new blank form to allow another record to be added.
the problem is a new form wont load - instead I get a blank page. Error Reporting indicates two errors its more the second one that im concerned with though as the firs one isnt causing too many problems.
I know what the errors mean but dont know how to correct them because I cant see the problem.
Here are the errors
1 - PHP NOTICE - Undefined Variable: notes in processpeople.php at line 43
2- PHP WARNING - Cannot modify header information - headers already sent on line 52
Ok heres my code
When I add a record in my form and press submit the file processpeople.php is loaded - this file consists of an insert statement which works perfectly fine and inserts my data, BUT at the bottom of the file I have a line of code which basically links to a new blank form to allow another record to be added.
the problem is a new form wont load - instead I get a blank page. Error Reporting indicates two errors its more the second one that im concerned with though as the firs one isnt causing too many problems.
I know what the errors mean but dont know how to correct them because I cant see the problem.
Here are the errors
1 - PHP NOTICE - Undefined Variable: notes in processpeople.php at line 43
2- PHP WARNING - Cannot modify header information - headers already sent on line 52
Ok heres my code
Code: Select all
<?php
error_reporting(E_ALL); // error reporting set to display all
/*Connecting, selecting database*/
$link = mysql_connect("vxxxxx", "xxxxx", "xxxxx")
or die("Could not connect : " . mysql_error());
mysql_select_db("contact_management_system",$link) or die("Could not select database");
PRINT $sql = "INSERT INTO people
(
person_id, salutation, firstname, surname,
organisation, role, address1, address2,
city, postcode, telephone, mobile, fax,
dateoflastcontact, datecontactagain, notes, email,
org_id, consultation_panel_member, primary_contact, primarycontactemail, advertising_grad_jobs,offer_mscproject,offer_ugproject,
professional_devactivities,bcs_membership,bcs_pds,
teaching_courses,academic_consultancy,employer_feedback
)
VALUES
(
'$person_id','$salutation','$firstname','$surname',
'$organisation', '$role', '$address1', '$address2',
'$city', '$postcode', '$telephone', '$mobile', '$fax','$dateoflastcontact',
'$datecontactagain','$notes','$email','$org_id',
'$consultation_panel_member','$primary_contact',
'$primarycontactemail','$advertising_grad_jobs',
'$offer_mscproject','$offer_ugproject',
'$professional_devactivities','$bcs_membership','$bcs_pds',
'$teaching_courses','$academic_consultancy','$employer_feedback'
)";
$result = mysql_query($sql, $link) or die ( mysql_error($link));
header("location: http://www.soi.city.ac.uk/organisation/ ... eople.html");
?>