Jump to content

Recommended Posts

Hi All,

 

I have read the sections refering to the following error message

"Cannot modify header information - headers already sent by " and have tried to follow their suggestions.

The first part of the program returns the required data and populates the form, but after changes are made to the data and an attempt to process the form is made the error message is produced I believe from the start of the php code.

I am just learning both PHP and MySQL and am unsure how to proceed so any pointers would be helpful.

Regards

 

Hamish

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Update Programme Leader*</title>

</head>

<body>

<?php

ob_start();

// Connect database.

include("opendbincludeA.php");

// ***** This part will process when you Click on "Submit" button *****

// Check, if you clicked "Submit" button

if($_POST['Submit']){

// Get parameters from form.

$ID_Number=$_POST['ID_Number'];

$UCAS_Code=$_POST['UCAS_Code'];

$CourseName=$_POST['CourseName'];

$PLTitle=$_POST['PLTitle'];

$PLFirstName=$_POST['PLFirstName'];

$PLName=$_POST['PLName'];

$PLemailAddress=$_POST['PLemailAddress'];

$PLTelNo=$_POST['PLTelNo'];

$PLContractStart=$_POST['PLContractStart'];

$PLContractEnd=$_POST['PLContractEnd'];

$PLActive=$_POST['PLActive'];

// Do update statement.

mysql_query("update P_Leader set UCAS_Code='$UCAS_Code', CourseName='$CourseName', PLTitle='$PLTitle', PLFirstName='$PLFirstName', PLName='$PLName', PLemailAddress='$PLemailAddress', PLTelNo='$PLTelNo', PLContractStart='$PLContractStart', PLContractEnd='$ContractEnd', PLActive='$PLActive' where ID_Number='$ID_Number'");

// Re-direct this page to updateZX.php.

header("location:updateZX.php");

exit;

}

// ************* End update part *************

 

// *** Select data to show on text fields in form. ***

 

// Get id parameter (GET method) from updateZX.php

$ID_Number=$_GET['ID_Number'];

 

// Get records in all columns from table where column id equal in $id and put it in $result.

$result=mysql_query("select * from P_Leader where ID_Number='$ID_Number'");

 

// Split records in $result by table rows and put them in $row.

$row=mysql_fetch_assoc($result);

 

// Close database connection.

 

ob_end_flush();

mysql_close();

?>

 

 

<!-- set this form to POST method and target this form to itself ($PHP_SELF;)-->

<form id="form1" name="form1" method="post" action="<? echo $PHP_SELF; ?>">

<p>

<br />

UCAS Code :

<!-- name of this text field is "UCAS_Code" -->

<input name="UCAS_Code" type="text" id="UCAS_Code" value="<? echo $row['UCAS_Code']; ?>"/>

<br />

Title :

<!-- name of this text field is "CourseName" -->

<input name="CourseName" type="text" id="CourseName" value="<? echo $row['CourseName']; ?>"/>

<br />

Title :

<!-- name of this text field is "PLTitle" -->

<input name="PLTitle" type="text" id="PLTitle" value="<? echo $row['PLTitle']; ?>"/>

<br />

First Name :

<!-- name of this text field is "PLFirstName" -->

<input name="PLFirstName" type="text" id="PLFirstName" value="<? echo $row['PLFirstName']; ?>"/>

<br />

Name :

<!-- name of this text field is "PLSName" -->

<input name="PLSName" type="text" id="PLSName" value="<? echo $row['PLSName']; ?>"/>

<br />

email :

<!-- name of this text field is "PLemailAddress" -->

<input name="PLemailAddress" type="text" id="PLemailAddress" value="<? echo $row['PLemailAddress']; ?>"/>

<br />

Tel No :

<!-- name of this text field is "PLTelNo" -->

<input name="PLTelNo" type="text" id="PLTelNo" value="<? echo $row['PLTelNo']; ?>"/>

<br  />

Contract Start :

<!-- name of this text field is "PLContractStart" -->

<input name="PLContractStart" type="text" id="PLContractStart" value="<? echo $row['PLContractStart']; ?>"/>

 

<br  />

Contract End :

<!-- name of this text field is "PLContractEnd" -->

<input name="PLContractEnd" type="text" id="PLContractEnd" value="<? echo $row['PLContractEnd']; ?>"/>

 

<br  />

Active :

<!-- name of this text field is "PLActive" -->

<input name="PLActive" type="text" id="PLActive" value="<? echo $row['PLActive']; ?>"/>

</p>

<p>

<input type="submit" name="Submit" value="Submit" />

</p>

</form>

</body>

</html>

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/48528-solved-header-error/
Share on other sites

remove:

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Update Programme Leader*</title>

</head>

<body>

 

 

that should solve your problem

Link to comment
https://forums.phpfreaks.com/topic/48528-solved-header-error/#findComment-237463
Share on other sites

You need to make sure that if you use the buffer, that it starts before any html content.  put ob_start at the very top of your page and make sure there are no spaces before the <?php.  Also try putting ob_end_flush(); at the very bottom of your page and make sure there are no spaces after the ?>. 

 

Link to comment
https://forums.phpfreaks.com/topic/48528-solved-header-error/#findComment-237745
Share on other sites

Hi All,

 

I have made all the suggested changes to my code, and have checked for whitespace too.

 

Is there some software that can check for errors in white space that I can run my code through?

 

Otherwise I seem to be stuck with the same problem with the headers.

Regards

 

Hamish

Link to comment
https://forums.phpfreaks.com/topic/48528-solved-header-error/#findComment-237968
Share on other sites

try this


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Update Programme Leader*</title>
</head>
<body>
<?php
ob_start();
// Connect database.
@include("opendbincludeA.php");
// ***** This part will process when you Click on "Submit" button *****
// Check, if you clicked "Submit" button
if($_POST['Submit'])
{
// Get parameters from form.
$ID_Number=$_POST['ID_Number'];
$UCAS_Code=$_POST['UCAS_Code'];
$CourseName=$_POST['CourseName'];
$PLTitle=$_POST['PLTitle'];
$PLFirstName=$_POST['PLFirstName'];
$PLName=$_POST['PLName'];
$PLemailAddress=$_POST['PLemailAddress'];
$PLTelNo=$_POST['PLTelNo'];
$PLContractStart=$_POST['PLContractStart'];
$PLContractEnd=$_POST['PLContractEnd'];
$PLActive=$_POST['PLActive'];
// Do update statement.
@mysql_query("update P_Leader set UCAS_Code='$UCAS_Code', CourseName='$CourseName', PLTitle='$PLTitle', PLFirstName='$PLFirstName', PLName='$PLName', PLemailAddress='$PLemailAddress', PLTelNo='$PLTelNo', PLContractStart='$PLContractStart', PLContractEnd='$ContractEnd', PLActive='$PLActive' where ID_Number='$ID_Number'");
// Re-direct this page to updateZX.php.
header("location: updateZX.php");
exit;
}else(
// ************* End update part *************

// *** Select data to show on text fields in form. ***

// Get id parameter (GET method) from updateZX.php
$ID_Number=$_GET['ID_Number'];

// Get records in all columns from table where column id equal in $id and put it in $result.
$result=mysql_query("select * from P_Leader where ID_Number='$ID_Number'");

// Split records in $result by table rows and put them in $row.
$row=mysql_fetch_assoc($result);

?>


<!-- set this form to POST method and target this form to itself ($PHP_SELF;)-->
<form id="form1" name="form1" method="post" action="<?php echo $PHP_SELF; ?>">
<p>


UCAS Code :
<!-- name of this text field is "UCAS_Code" -->
<input name="UCAS_Code" type="text" id="UCAS_Code" value="<?php echo $row['UCAS_Code']; ?>"/>


Title :
<!-- name of this text field is "CourseName" -->
<input name="CourseName" type="text" id="CourseName" value="<?php echo $row['CourseName']; ?>"/>


Title :
<!-- name of this text field is "PLTitle" -->
<input name="PLTitle" type="text" id="PLTitle" value="<?php echo $row['PLTitle']; ?>"/>


First Name :
<!-- name of this text field is "PLFirstName" -->
<input name="PLFirstName" type="text" id="PLFirstName" value="<?php echo $row['PLFirstName']; ?>"/>


Name :
<!-- name of this text field is "PLSName" -->
<input name="PLSName" type="text" id="PLSName" value="<?php echo $row['PLSName']; ?>"/>


email :
<!-- name of this text field is "PLemailAddress" -->
<input name="PLemailAddress" type="text" id="PLemailAddress" value="<?php echo $row['PLemailAddress']; ?>"/>


Tel No :
<!-- name of this text field is "PLTelNo" -->
<input name="PLTelNo" type="text" id="PLTelNo" value="<?php echo $row['PLTelNo']; ?>"/>
<br  />
Contract Start :
<!-- name of this text field is "PLContractStart" -->
<input name="PLContractStart" type="text" id="PLContractStart" value="<?php echo $row['PLContractStart']; ?>"/>

<br  />
Contract End :
<!-- name of this text field is "PLContractEnd" -->
<input name="PLContractEnd" type="text" id="PLContractEnd" value="<?php echo $row['PLContractEnd']; ?>"/>

<br  />
Active :
<!-- name of this text field is "PLActive" -->
<input name="PLActive" type="text" id="PLActive" value="<?php echo $row['PLActive']; ?>"/>
</p>
<p>
<input type="submit" name="Submit" value="Submit" />
</p>
</form>

<?php

// Close database connection.
}

ob_end_flush();
mysql_close();

?>

</body>
</html>

 

if this fails please comment out the ob_end_flush(); and ob_flush(); and post the errors

Link to comment
https://forums.phpfreaks.com/topic/48528-solved-header-error/#findComment-237992
Share on other sites

oooops

 

updated

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Update Programme Leader*</title>
</head>
<body>
<?php
ob_start();
// Connect database.
@include("opendbincludeA.php");
// ***** This part will process when you Click on "Submit" button *****
// Check, if you clicked "Submit" button
if($_POST['Submit'])
{
// Get parameters from form.
$ID_Number=$_POST['ID_Number'];
$UCAS_Code=$_POST['UCAS_Code'];
$CourseName=$_POST['CourseName'];
$PLTitle=$_POST['PLTitle'];
$PLFirstName=$_POST['PLFirstName'];
$PLName=$_POST['PLName'];
$PLemailAddress=$_POST['PLemailAddress'];
$PLTelNo=$_POST['PLTelNo'];
$PLContractStart=$_POST['PLContractStart'];
$PLContractEnd=$_POST['PLContractEnd'];
$PLActive=$_POST['PLActive'];
// Do update statement.
@mysql_query("update P_Leader set UCAS_Code='$UCAS_Code', CourseName='$CourseName', PLTitle='$PLTitle', PLFirstName='$PLFirstName', PLName='$PLName', PLemailAddress='$PLemailAddress', PLTelNo='$PLTelNo', PLContractStart='$PLContractStart', PLContractEnd='$ContractEnd', PLActive='$PLActive' where ID_Number='$ID_Number'");
// Re-direct this page to updateZX.php.
header("location: updateZX.php");
exit;
}else{
// ************* End update part *************

// *** Select data to show on text fields in form. ***

// Get id parameter (GET method) from updateZX.php
$ID_Number=$_GET['ID_Number'];

// Get records in all columns from table where column id equal in $id and put it in $result.
$result=mysql_query("select * from P_Leader where ID_Number='$ID_Number'");

// Split records in $result by table rows and put them in $row.
$row=mysql_fetch_assoc($result);

?>


<!-- set this form to POST method and target this form to itself ($PHP_SELF;)-->
<form id="form1" name="form1" method="post" action="<?php echo $PHP_SELF; ?>">
<p>


UCAS Code :
<!-- name of this text field is "UCAS_Code" -->
<input name="UCAS_Code" type="text" id="UCAS_Code" value="<?php echo $row['UCAS_Code']; ?>"/>


Title :
<!-- name of this text field is "CourseName" -->
<input name="CourseName" type="text" id="CourseName" value="<?php echo $row['CourseName']; ?>"/>


Title :
<!-- name of this text field is "PLTitle" -->
<input name="PLTitle" type="text" id="PLTitle" value="<?php echo $row['PLTitle']; ?>"/>


First Name :
<!-- name of this text field is "PLFirstName" -->
<input name="PLFirstName" type="text" id="PLFirstName" value="<?php echo $row['PLFirstName']; ?>"/>


Name :
<!-- name of this text field is "PLSName" -->
<input name="PLSName" type="text" id="PLSName" value="<?php echo $row['PLSName']; ?>"/>


email :
<!-- name of this text field is "PLemailAddress" -->
<input name="PLemailAddress" type="text" id="PLemailAddress" value="<?php echo $row['PLemailAddress']; ?>"/>


Tel No :
<!-- name of this text field is "PLTelNo" -->
<input name="PLTelNo" type="text" id="PLTelNo" value="<?php echo $row['PLTelNo']; ?>"/>
<br  />
Contract Start :
<!-- name of this text field is "PLContractStart" -->
<input name="PLContractStart" type="text" id="PLContractStart" value="<?php echo $row['PLContractStart']; ?>"/>

<br  />
Contract End :
<!-- name of this text field is "PLContractEnd" -->
<input name="PLContractEnd" type="text" id="PLContractEnd" value="<?php echo $row['PLContractEnd']; ?>"/>

<br  />
Active :
<!-- name of this text field is "PLActive" -->
<input name="PLActive" type="text" id="PLActive" value="<?php echo $row['PLActive']; ?>"/>
</p>
<p>
<input type="submit" name="Submit" value="Submit" />
</p>
</form>

<?php

// Close database connection.
}

ob_end_flush();
mysql_close();

?>

</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/48528-solved-header-error/#findComment-238014
Share on other sites

Hi MadTechie,

 

The program now returns the form details, without the line breaks. But does not process update details nor when commenting out "ob_start" and "ob_end_flush"

The same error message

"Cannot modify header information - headers already sent by " PLupdate1.php:8" "PLupdate1.php on line 31"

 

Hamish

 

Link to comment
https://forums.phpfreaks.com/topic/48528-solved-header-error/#findComment-238018
Share on other sites

of course, this should work!

 

i forgot to move a chunk down

 

PS that error message helped

 


<?php
ob_start();

// Connect database.
@include("opendbincludeA.php");
// ***** This part will process when you Click on "Submit" button *****
// Check, if you clicked "Submit" button
if($_POST['Submit'])
{
// Get parameters from form.
$ID_Number=$_POST['ID_Number'];
$UCAS_Code=$_POST['UCAS_Code'];
$CourseName=$_POST['CourseName'];
$PLTitle=$_POST['PLTitle'];
$PLFirstName=$_POST['PLFirstName'];
$PLName=$_POST['PLName'];
$PLemailAddress=$_POST['PLemailAddress'];
$PLTelNo=$_POST['PLTelNo'];
$PLContractStart=$_POST['PLContractStart'];
$PLContractEnd=$_POST['PLContractEnd'];
$PLActive=$_POST['PLActive'];
// Do update statement.
@mysql_query("update P_Leader set UCAS_Code='$UCAS_Code', CourseName='$CourseName', PLTitle='$PLTitle', PLFirstName='$PLFirstName', PLName='$PLName', PLemailAddress='$PLemailAddress', PLTelNo='$PLTelNo', PLContractStart='$PLContractStart', PLContractEnd='$ContractEnd', PLActive='$PLActive' where ID_Number='$ID_Number'");
// Re-direct this page to updateZX.php.
header("location: updateZX.php");
exit;
}else{
// ************* End update part *************

// *** Select data to show on text fields in form. ***

// Get id parameter (GET method) from updateZX.php
$ID_Number=$_GET['ID_Number'];

// Get records in all columns from table where column id equal in $id and put it in $result.
$result=mysql_query("select * from P_Leader where ID_Number='$ID_Number'");

// Split records in $result by table rows and put them in $row.
$row=mysql_fetch_assoc($result);

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Update Programme Leader*</title>
</head>
<body>


<!-- set this form to POST method and target this form to itself ($PHP_SELF;)-->
<form id="form1" name="form1" method="post" action="<?php echo $PHP_SELF; ?>">
<p>


UCAS Code :
<!-- name of this text field is "UCAS_Code" -->
<input name="UCAS_Code" type="text" id="UCAS_Code" value="<?php echo $row['UCAS_Code']; ?>"/>


Title :
<!-- name of this text field is "CourseName" -->
<input name="CourseName" type="text" id="CourseName" value="<?php echo $row['CourseName']; ?>"/>


Title :
<!-- name of this text field is "PLTitle" -->
<input name="PLTitle" type="text" id="PLTitle" value="<?php echo $row['PLTitle']; ?>"/>


First Name :
<!-- name of this text field is "PLFirstName" -->
<input name="PLFirstName" type="text" id="PLFirstName" value="<?php echo $row['PLFirstName']; ?>"/>


Name :
<!-- name of this text field is "PLSName" -->
<input name="PLSName" type="text" id="PLSName" value="<?php echo $row['PLSName']; ?>"/>


email :
<!-- name of this text field is "PLemailAddress" -->
<input name="PLemailAddress" type="text" id="PLemailAddress" value="<?php echo $row['PLemailAddress']; ?>"/>


Tel No :
<!-- name of this text field is "PLTelNo" -->
<input name="PLTelNo" type="text" id="PLTelNo" value="<?php echo $row['PLTelNo']; ?>"/>
<br  />
Contract Start :
<!-- name of this text field is "PLContractStart" -->
<input name="PLContractStart" type="text" id="PLContractStart" value="<?php echo $row['PLContractStart']; ?>"/>

<br  />
Contract End :
<!-- name of this text field is "PLContractEnd" -->
<input name="PLContractEnd" type="text" id="PLContractEnd" value="<?php echo $row['PLContractEnd']; ?>"/>

<br  />
Active :
<!-- name of this text field is "PLActive" -->
<input name="PLActive" type="text" id="PLActive" value="<?php echo $row['PLActive']; ?>"/>
</p>
<p>
<input type="submit" name="Submit" value="Submit" />
</p>
</form>

<?php

// Close database connection.
}

ob_end_flush();
mysql_close();

?>

</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/48528-solved-header-error/#findComment-238026
Share on other sites

ok this i think is the root of the problem..

 

 

for testing

comment out the

ob_start();

 

and

change

<?php
@mysql_query("update P_Leader set UCAS_Code='$UCAS_Code', CourseName='$CourseName', PLTitle='$PLTitle', PLFirstName='$PLFirstName', PLName='$PLName', PLemailAddress='$PLemailAddress', PLTelNo='$PLTelNo', PLContractStart='$PLContractStart', PLContractEnd='$ContractEnd', PLActive='$PLActive' where ID_Number='$ID_Number'");
// Re-direct this page to updateZX.php.
header("location: updateZX.php");
exit;

?>

 

to

 

<?php

$SQLq = "update P_Leader set UCAS_Code='$UCAS_Code', CourseName='$CourseName', PLTitle='$PLTitle', PLFirstName='$PLFirstName', PLName='$PLName', PLemailAddress='$PLemailAddress', PLTelNo='$PLTelNo', PLContractStart='$PLContractStart', PLContractEnd='$ContractEnd', PLActive='$PLActive' where ID_Number='$ID_Number'";
mysql_query($SQLq) or die("query error: $SQLq<br>".mysql_error());
// Re-direct this page to updateZX.php.
exit;

?>

 

and lets review the error,

Link to comment
https://forums.phpfreaks.com/topic/48528-solved-header-error/#findComment-238045
Share on other sites

 

 

The program runs without error messages both with and without ob_start(); commented.

The form appears to be processed but returns a blank screen showing "PLupdate1.php" in the address window  against "PLupdate1.php?ID_Number=1029" which was showing before submit.

Refreshing the form page shows no change to the database record, nor does checking through PHPMyAdmin.

 

Hamish

 

Link to comment
https://forums.phpfreaks.com/topic/48528-solved-header-error/#findComment-238062
Share on other sites

was missing the ID_number

 

<?php
ob_start();

// Connect database.
@include("opendbincludeA.php");
// ***** This part will process when you Click on "Submit" button *****
// Check, if you clicked "Submit" button
if($_POST['Submit'])
{
// Get parameters from form.
$ID_Number=$_POST['ID_Number'];
$UCAS_Code=$_POST['UCAS_Code'];
$CourseName=$_POST['CourseName'];
$PLTitle=$_POST['PLTitle'];
$PLFirstName=$_POST['PLFirstName'];
$PLName=$_POST['PLName'];
$PLemailAddress=$_POST['PLemailAddress'];
$PLTelNo=$_POST['PLTelNo'];
$PLContractStart=$_POST['PLContractStart'];
$PLContractEnd=$_POST['PLContractEnd'];
$PLActive=$_POST['PLActive'];
// Do update statement.
@mysql_query("update P_Leader set UCAS_Code='$UCAS_Code', CourseName='$CourseName', PLTitle='$PLTitle', PLFirstName='$PLFirstName', PLName='$PLName', PLemailAddress='$PLemailAddress', PLTelNo='$PLTelNo', PLContractStart='$PLContractStart', PLContractEnd='$ContractEnd', PLActive='$PLActive' where ID_Number='$ID_Number'");
// Re-direct this page to updateZX.php.
$ID_Number=$_POST['ID_Number'];
header("location: updateZX.php?ID_Number=$ID_Number");
exit;
}else{
// ************* End update part *************

// *** Select data to show on text fields in form. ***

// Get id parameter (GET method) from updateZX.php
$ID_Number=$_GET['ID_Number'];

// Get records in all columns from table where column id equal in $id and put it in $result.
$result=mysql_query("select * from P_Leader where ID_Number='$ID_Number'");

// Split records in $result by table rows and put them in $row.
$row=mysql_fetch_assoc($result);

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Update Programme Leader*</title>
</head>
<body>


<!-- set this form to POST method and target this form to itself ($PHP_SELF;)-->
<form id="form1" name="form1" method="post" action="<?php echo $PHP_SELF; ?>">
<p>
<input name="ID_Number" type="hidden" id="ID_Number" value="<?php echo $row['ID_Number']; ?>"/>


UCAS Code :
<!-- name of this text field is "UCAS_Code" -->
<input name="UCAS_Code" type="text" id="UCAS_Code" value="<?php echo $row['UCAS_Code']; ?>"/>


Title :
<!-- name of this text field is "CourseName" -->
<input name="CourseName" type="text" id="CourseName" value="<?php echo $row['CourseName']; ?>"/>


Title :
<!-- name of this text field is "PLTitle" -->
<input name="PLTitle" type="text" id="PLTitle" value="<?php echo $row['PLTitle']; ?>"/>


First Name :
<!-- name of this text field is "PLFirstName" -->
<input name="PLFirstName" type="text" id="PLFirstName" value="<?php echo $row['PLFirstName']; ?>"/>


Name :
<!-- name of this text field is "PLSName" -->
<input name="PLSName" type="text" id="PLSName" value="<?php echo $row['PLSName']; ?>"/>


email :
<!-- name of this text field is "PLemailAddress" -->
<input name="PLemailAddress" type="text" id="PLemailAddress" value="<?php echo $row['PLemailAddress']; ?>"/>


Tel No :
<!-- name of this text field is "PLTelNo" -->
<input name="PLTelNo" type="text" id="PLTelNo" value="<?php echo $row['PLTelNo']; ?>"/>
<br  />
Contract Start :
<!-- name of this text field is "PLContractStart" -->
<input name="PLContractStart" type="text" id="PLContractStart" value="<?php echo $row['PLContractStart']; ?>"/>

<br  />
Contract End :
<!-- name of this text field is "PLContractEnd" -->
<input name="PLContractEnd" type="text" id="PLContractEnd" value="<?php echo $row['PLContractEnd']; ?>"/>

<br  />
Active :
<!-- name of this text field is "PLActive" -->
<input name="PLActive" type="text" id="PLActive" value="<?php echo $row['PLActive']; ?>"/>
</p>
<p>
<input type="submit" name="Submit" value="Submit" />
</p>
</form>

<?php

// Close database connection.
}

ob_end_flush();
mysql_close();

?>

</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/48528-solved-header-error/#findComment-238074
Share on other sites

can you add this

// Do update statement.

@mysql_query("update P_Leader set UCAS_Code='$UCAS_Code', CourseName='$CourseName', PLTitle='$PLTitle', PLFirstName='$PLFirstName', PLName='$PLName', PLemailAddress='$PLemailAddress', PLTelNo='$PLTelNo', PLContractStart='$PLContractStart', PLContractEnd='$ContractEnd', PLActive='$PLActive' where ID_Number='$ID_Number'");

 

die("update P_Leader set UCAS_Code='$UCAS_Code', CourseName='$CourseName', PLTitle='$PLTitle', PLFirstName='$PLFirstName', PLName='$PLName', PLemailAddress='$PLemailAddress', PLTelNo='$PLTelNo', PLContractStart='$PLContractStart', PLContractEnd='$ContractEnd', PLActive='$PLActive' where ID_Number='$ID_Number'");

// Re-direct this page to updateZX.php.

$ID_Number=$_POST['ID_Number'];

header("location: updateZX.php?ID_Number=$ID_Number");

exit;

 

comment out the ob_start();

 

it should display update P_.......

 

paste that into SQL in the phpMyAdmin, and let me know the results

Link to comment
https://forums.phpfreaks.com/topic/48528-solved-header-error/#findComment-238089
Share on other sites

I get the following error from MyAdmin

 

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@mysql_query("update P_Leader set UCAS_Code='$UCAS_Code', CourseName='$CourseNam' at line 1

 

Hamish

Link to comment
https://forums.phpfreaks.com/topic/48528-solved-header-error/#findComment-238101
Share on other sites

Magic!!

 

Thank you very much MadTechie, the MySQL query pointed out to a typo in one of my fields in the database.

On correcting the error everything works like clockwork.

I have learnt a vast amount in the last few hours about how to find errors from you. Again thanks very much for all the time and trouble to resolve my stupid mistake.

 

Hamish

 

Link to comment
https://forums.phpfreaks.com/topic/48528-solved-header-error/#findComment-238129
Share on other sites

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.