Jump to content

Redirect Page


refiking

Recommended Posts

How can I redirect this page after I store the data into the database?  Here is the entire script:

 

<?php
session_start();
include 'connect.php';
$lcid=$_POST['lc_id'];
$password=$_POST['lcpass'];
$id = mysql_query("SELECT password FROM lreps WHERE lc_id = '$lcid'");
$fetch_em = mysql_fetch_array($id);
$numrows = mysql_num_rows($id);
IF($numrows != "0" & $password == $fetch_em["password"]) {
$result = mysql_query("SELECT * FROM CP");
$num = mysql_num_rows($result);
$lead_id = $num + 1;
echo $lead_id;
mysql_query("INSERT INTO `CP`(lc_id , lead_id , bfn , bln , bdob, bssn, cfn , cln , cssn, addy, zip , rty, rtime,
tenure, value, bemp, bjt, bjten, bb1, bb1a, bb2, bb2a, bb3, bb3a, cemp, cjt, cjten, cb1, cb1a, cb2, cb2a, cb3, cb3a, taxes, ins)
VALUES('$lcid','$lead_id','$bfn','$bln','$brdob','$brssn','$cfn','$cln','$cssn','$addy','$zip','$response','$rptime','$ten',
'$value','$bremp','$brjt','$brjhist','$bb1','$bb1a','$bb2','$bb2a','$bb3','$bb3a','$cemp','$cjt','$cjhist','$cb1','$cb1a','$cb2',
'$cb2a','$cb3','$cb3a','$taxes','$ins')")or die(mysql_error());

Print "This lead was succesfully entered into the system.";
// If it's desired to kill the session, also delete the session cookie.
// Note: This will destroy the session, and not just the session data!
if (isset($_COOKIE[session_name()])) {
    setcookie(session_name(), '', time()-42000, '/');
}

// Finally, destroy the session.
session_destroy();
?>
<html>
<head><title>1003 App</title></head>
<body>
<h2>Data Collection</h2><p>
<form action="app1.php" method="post">
<table>
<tr><td>Phone Number:</td><td><input type="text" name="Phone" /></td></tr>
<tr><td colspan="2" align="center"><input type="submit" value="Next" /></td></tr>
</table>
</form>
</body>
</html>
<?
}
ELSEIF ($numrows == "0") {
?>
<html>
<head><title>1003 App</title></head>
<body>
<h2>ID and Password Failure: Please re-enter.</h2><p>
<form action="loanappsave.php" method="post">
<table>
<tr><td>Loan Consultant ID:</td><td><input type="text" name="lc_id" /></td></tr>
<tr><td>Password:</td><td><input type="text" name="lcpass" /></td></tr>
<tr><td colspan="2" align="center"><input type="submit" value="Next" /></td></tr>
</table>
</form>
</body>
</html>
<?
}
ELSEIF ($password != $fetch_em["password"]) {
?>
<html>
<head><title>1003 App</title></head>
<body>
<h2>ID and Password Failure: Please re-enter.</h2><p>
<form action="loanappsave.php" method="post">
<table>
<tr><td>Loan Consultant ID:</td><td><input type="text" name="lc_id" /></td></tr>
<tr><td>Password:</td><td><input type="text" name="lcpass" /></td></tr>
<tr><td colspan="2" align="center"><input type="submit" value="Next" /></td></tr>
</table>
</form>
</body>
</html>
<?
}
?>

 

And this is the line that I am talking about specifically:

 

Print "This lead was succesfully entered into the system.";
// If it's desired to kill the session, also delete the session cookie.
// Note: This will destroy the session, and not just the session data!
if (isset($_COOKIE[session_name()])) {
    setcookie(session_name(), '', time()-42000, '/');
}

// Finally, destroy the session.
session_destroy();
?>
<html>
<head><title>1003 App</title></head>
<body>
<h2>Data Collection</h2><p>
<form action="app1.php" method="post">
<table>
<tr><td>Phone Number:</td><td><input type="text" name="Phone" /></td></tr>
<tr><td colspan="2" align="center"><input type="submit" value="Next" /></td></tr>
</table>
</form>
</body>
</html>
<?
}

 

Instead of trying to add the HTML code, I want to just redirect to app.php

Link to comment
Share on other sites

Warning: Cannot modify header information - headers already sent by (output started at /home/refiking/public_html/apps/loanappsave.php:13) in /home/refiking/public_html/apps/loanappsave.php on line 24

 

Warning: Cannot modify header information - headers already sent by (output started at /home/refiking/public_html/apps/loanappsave.php:13) in /home/refiking/public_html/apps/loanappsave.php on line 29

 

Line 23-25:

if (isset($_COOKIE[session_name()])) {
    setcookie(session_name(), '', time()-42000, '/');
}

 

Line 29:

header("Location: /app.php");

Link to comment
Share on other sites

You need to make sure the header call happens before any output is sent to the browser. Headers are sent before the html is rendered out to the browser, thus needing it set before this action happens. In your code above, you have several echo's. Remove them or rearrange things as to not output data so that the header can be set.

Link to comment
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.