Jump to content

[SOLVED] Simple Redirect Problem!


me1000

Recommended Posts

Can someone please help me??  ??? ??? ??? ???

 

if (isset($inType)) {
       $query = "INSERT INTO $sTableName (TYPE, LINK, DATE, DESCRIPTION) VALUES ('$inType', '$inLink', '$inDate', '$inDescription')";
$result = mysql_query($query);
$response = ($result) ? "Record Added" : "Error adding record!"; 
echo $response;
header ("Location: process.php");
   
        
}

 

Everything works great it even comes back and says "Record Added" All data is entered into the Database just like it should be!

 

BUT IT WONT REDIRECT! what am I missing? lol

I have looked at it for about 30 minutes now, maybe some fresh eyes will help!

 

 

Thank You,

 

Link to comment
https://forums.phpfreaks.com/topic/54067-solved-simple-redirect-problem/
Share on other sites

try this:

 

if (isset($inType)) {
       $query = "INSERT INTO $sTableName (TYPE, LINK, DATE, DESCRIPTION) VALUES ('$inType', '$inLink', '$inDate', '$inDescription')";
$result = mysql_query($query);
$response = ($result) ? "Record Added" : "Error adding record!"; 
echo '<meta http-equiv=\"refresh\" content=\"3;URL=process.php\">'.$response.'';
   
        
}

 

that will refresh to process.php in 3 seconds

with php headers you cannot echo anything before the header.

 

Meaning anything you echo has to be after the header() call which people will not see unless you do the refresh header, which you would need to post the echo AFTER the header call either way. Hope that helps.

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.