very new to this, so I apologize in advance for rookie mistakes.
I am currently working through one of the PHP/MySQL introductory series from lynda.com. I am loving it thus far, and have been having success, but this one's got me confused.
I have created a form for user input, called new_subject.php. The following is called create_subject.php, and it meant to process the form data from new_subject.php. Please keep in mind that I have not yet added any code to do this, I am just testing a redirect function:
<?php require_once("../includes/db_connection.php"); ?>
<?php require_once("../includes/functions.php"); ?>
<?php
if (isset($_POST['submit'])) {
} else {
// This is probably a GET request
redirect_to("new_subject.php");
}
?>
<?php
if (isset($connection)) {mysqli_close($connection);}
?>
The point of the redirect_to function is to redirect the user to the form at new_subject.php if they were to type in create_subject.php manually in the browser. Here is what redirect_to function looks like in functions.php:
function redirect_to($new_location) {
header("Location: " . $new_location);
exit;
}
I am getting the following error when trying to get to create_subject.php manually:
Fatal error: Call to undefined function redirect_to()
The tutorial video says that I can either turn on output buffering, which I have tried to do in my php.ini file, but the error remains the same. The video says I can do that, or "fix the white space issue." I have no idea what this means.
I would appreciate any info on what this "white space issue" is, and if there is anything else I can do here. As far as I can see, I should be able to call this function without issues.
Thanks