So i currently have 6 files being used in my project index.html index.php functions.php leap_year.php time.php submit.php.
I collect information in index.html using
<form action ="submit.php" method="post">
<!-- inside index.html-->
<select name="day">
<option value=1>1</option>
<option value=2>2</option>
</select>
which is sent to submit.php by using $_POST
// inside submit.php
global $day;
$day = $_POST["day"] ;
global $type;
$type = $_POST["type"];
header("Location: /index.php");
// I have not included the file path here but it works
// post MUST be used.
there are no issues with the code above and all variables are accessible and usable in submit.php Now we need day and all other variables to be used inside of index.php so i have tried using include
// inside of index.php
include "submit.php";
if($type==="leaper"){
header("Location:leap_year.php");
}
this causes an undefined index error on line 3 (the if statement) playing around and testing with things like is_null confirms theres is no longer data in type or it was not passed on. I need all of my variables available in all of my files. I thought that using include would make this possible but it does not seem to work. I've also tried using session but i have the same result.
I've also tried PHP, getting variable from another php-file and this was of no help. I need the data that the user enters to go across multiple files