Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff
Author Message
Doulos
Life Cycles Becoming CPU Cycles


Joined: Jun 06, 2005
Posts: 628

PostPosted: Fri Mar 31, 2017 12:23 am Reply with quote

I have been having trouble figuring this out. I have spent hours with google and trying different ways to hack my way to success, so I am hoping some of you experts can help me.

Everything posts fine (to the db) with the following code but it stays on the form afterward. I would like to get it to redirect to another page.

Code:
if ($conn->query($sql) === TRUE) {   

    echo "<div style='width=800px; text-align:center'><h1 style='text-align:center'>New record successfully created.</h1></div>";   
} else {
    echo "Error: " . $sql . "<br>" . $conn->error;
}


I have tried several different ways to get it to go to another page after a successful submission:

Code:
if ($conn->query($sql) === TRUE) {   

    header: ("Location: redirect.php");
} else {
    echo "Error: " . $sql . "<br>" . $conn->error;
$conn->close();
}

}

This give me the following message:
Quote:
The file requested was not found
Hint: Verify that the file exists - Filenames are usually case sensitive - Check for spelling errors

Refered From : Only registered users can see links on this board! Get registered or login!
Your IP : 73.37.41.223
Page Requested : /modules.php?name=ErrorDocuments&file=404&rs=500.shtml
Agent : Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0
Redirect Status : 200


Putting the following right before the closing form tag does not do anything different that without it. I have tried several different iterations of that code, including using the full URL of the file. I have also tried putting it right after $conn->close(); but before the final } in the previous code.

Code:
<!---- Including PHP File Here ---->

<?php
include "redirect.php";
?>


Obviously, I don't have a clue what I am doing. Any help would be appreciated.
Thanks.


Last edited by Doulos on Fri Mar 31, 2017 12:59 pm; edited 1 time in total 
View user's profile Send private message
Doulos
PostPosted: Fri Mar 31, 2017 12:40 pm Reply with quote

I figured it out. I was using a direct link to the file, after I created a module for the specific page it worked fine.

Code:
header ('Location: redirect.php') // does not work

header ('Location: /modules/Redirect/index.php') // WORKED


Thanks for taking a look.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©