Forum Moderators: coopster

Message Too Old, No Replies

care to help me how to redirect to other page

help me with my php code

         

nichie01

5:03 am on Sep 19, 2007 (gmt 0)

10+ Year Member



pls someone help me with my codes, the error message is: Warning: Cannot modify header information - headers already sent by (output started at /home2/ourbanke/public_html/processcalc.php:8) in /home2/ourbanke/public_html/processcalc.php on line 62

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

<body bgcolor="#FFFFFF" text="#000000">
<?
$username="";
$password="";
$database="ourbanke_ourbanker";

mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");

$query2="SELECT * FROM income";
$result=mysql_query($query2);
$combine=mysql_result($result,"combine");
// mysql_close();

$amount = $_POST["amount"];
$marketvalue1 = "$amount" * 0.80;
$maxloan1 = $_POST["maxloan"];
$maxloan2 = $_POST["maxloan"] * 0.70;
$amtdesired1 = $_POST["amtdesired"];
$ratio = "$maxloan1" / "$amtdesired1";
$months = $_POST["months"];
$interest = $_POST["interest"];
$ratedec = $_POST["interest"] * "0.01";
$percent = "$ratedec" / $_POST["months"];
$total1 = $_POST["amtdesired"] * "$percent";
$expo1 = "1.00" + "$percent";
$counter = "1.00";
$expo2 = "$expo1" * "$expo1";
$expo3 = "$expo2";
$months2 = $_POST["months"] - 1;
while ( $counter < "$months2" ){
$expo3 = "$expo3" * "$expo1";
$counter = "$counter" + "1.00";
}
$rate1 = "1.00" / "$expo3";
$rate2 = "1.00" - "$rate1";
$total5 = "$total1" / "$rate2";
$ratio2 = "$total5" / "$combine";
$ratio3 = "$ratio2" * 100;

$query = "INSERT INTO tempbank VALUES ('','$amount','$maxloan1','$amtdesired1','$months','$interest','$marketvalue1','$maxloan2','$amtdesired1','$ratio','$total5','$ratio3')";

mysql_query($query);

mysql_close();

if ( $ratio >= 1.0 ) {
$score1 = "SATISFACTORY";
$advisory1 = " ";
$advisory2 = " ";

} else {
$score1 = "UNSATISFACTORY";
$advisory1 = "Sorry. Amount desired must be not exceed maximum loan value.";
$URL="http://www.example.net/index.php";
header("Location: $URL");
exit;
}

?>
</body>
</html>

[edited by: eelixduppy at 5:07 am (utc) on Sep. 19, 2007]
[edit reason] exemplified [/edit]

Habtom

6:07 am on Sep 19, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld.

header("Location: $URL");

You can't send headers that way, if you have any output to the browser on the lines ahead of this line.

Collect all the outputs (including html and spaces) you have into a variable, and echo it only when needed and not before that line sending headers.

Habtom

kunwarbs

7:47 am on Sep 19, 2007 (gmt 0)

10+ Year Member



adding <?php ob_start();?> at the beginning of the document i.e. before <HTML> should fix this problem.

henry0

11:40 am on Sep 19, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I rather do it once for all
and allow output buffering in your php.ini

Of course if you do not have access to it; the other method should do well.

d40sithui

6:25 pm on Sep 19, 2007 (gmt 0)

10+ Year Member



habton is right. you need to remove your html tags at the top if u want to use headers to redirect. otherwise, you can also use javascript to redirect if you want to keep those tags.