Jump to content

redirecting browser


brad12345

Recommended Posts

Warning: Cannot modify header information - headers already sent by (output started at /home/it224/bradk/public_html/assignment1/newPatient.php:11) in

 

Error coming back? also a note it is not just a php script, the php script is inside the html, should this effect it?

Link to comment
https://forums.phpfreaks.com/topic/100569-redirecting-browser/#findComment-514363
Share on other sites

well then how am i supposed to run that code

 

maybe this will give better understanding

 

//Patient POST vaiables
$addPatient = $_POST['addPatient'];
$petName = $_POST['petName'];
$petSpecies = $_POST['petSpecies'];
$petBreed = $_POST['petBreed'];
$petAge = $_POST['petAge'];
$petWeight = $_POST['petWeight'];
$ownerID = $_POST['ownerID'];



echo("<font face='Arial'>");
$self = $_SERVER['PHP_SELF'];

//If a patient has been added from the form being filled out and 'addPatient' = true the preform below code	

if (isset($_POST['addPatient'])){
if(empty($petName) || empty($petSpecies) || empty($petBreed)) {
header("Location: http://kate/~bradk/newPatient.php");
}
//Adding patient into database
	$createQuery2 = "INSERT INTO tblPatientBK (petName, petSpecies, petBreed, petAge, petWeight, ownerID) VALUES ('$petName','$petSpecies','$petBreed','$petAge','$petWeight','$ownerID')";
	$result = mysql_query($createQuery2); //preforming mysql $createQuery2

	//displaying message to let user know the task has been carryed out and the patient has been added
	echo ("Thank you<p>Your new patient has been added successfully.<p>");

	echo("<a href='index.php'><font color='blue'>Return to home page</font></a>");

}		
else				  

 

also above all that is

 

<!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=utf-8" />
<title>Veterinarian Patient Management Tool</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" /></head>

<body>
<div id="wrap">
    
    <div class="header"></div>
    
    
    
    
    
    
    <div class="pageTitle"><a href="index.php">Home</a> | <a href="newOwner.php">Add New Owner</a> | <a href="newPatient.php">Add New Patient</a> | <a href="deletePatient.php">Delete a Patient</a> | <a href="echoDB.php">Report</a> | <a href="search.php">Search</a></div>
    <div class="content">

Link to comment
https://forums.phpfreaks.com/topic/100569-redirecting-browser/#findComment-514366
Share on other sites

Warning: Cannot modify header information - headers already sent by (output started at /home/it224/bradk/public_html/assignment1/newPatient.php:11) in

 

Error coming back? also a note it is not just a php script, the php script is inside the html, should this effect it?

 

Yes--that error message is exactly what you get if you use the header cmd and have already sent anything to the browswer.

Link to comment
https://forums.phpfreaks.com/topic/100569-redirecting-browser/#findComment-514371
Share on other sites

put this code on top of the html

 

<?php

if (isset($_POST['addPatient'])){
if(empty($petName) || empty($petSpecies) || empty($petBreed)) {
header("Location: http://kate/~bradk/newPatient.php");
}
//Adding patient into database
	$createQuery2 = "INSERT INTO tblPatientBK (petName, petSpecies, petBreed, petAge, petWeight, ownerID) VALUES ('$petName','$petSpecies','$petBreed','$petAge','$petWeight','$ownerID')";
	$result = mysql_query($createQuery2); //preforming mysql $createQuery2

	//displaying message to let user know the task has been carryed out and the patient has been added
	echo ("Thank you<p>Your new patient has been added successfully.<p>");

	echo("<a href='index.php'><font color='blue'>Return to home page</font></a>");

}		
else	

?>

Link to comment
https://forums.phpfreaks.com/topic/100569-redirecting-browser/#findComment-514373
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.