Variables are set and everything is displayed correctly in start.php.I can choose between both displayed variables in the form.
Problem is: The variable $projektcheck or $projektcheckk are not passed to nxtfile.php when selected and the form is submitted. When I check it with the print($_POST['prjkttype']); the variable is undefined and nothing gets printed. It instanly switches to my echo"Data is wrong";
Why does it not get passed to the other file although it is set and selected?
start.php:
<?PHP 
    session_start();
    $projektcheck = $_SESSION['projektname'];
    $projektcheckk = $_SESSION['projektnamee'];                
?>
 [other codestuff]
<script>
function validateForm() {
    var fields = ['prjkttype']
    var i, l = fields.length;
    var fieldname;
    for (i = 0; i < l; i++) {
        fieldname = fields[i];
    }   
    f1.method="POST";
    f1.submit();
}
</script>
[other codestuff]
<form action="nxtfile.php" method="POST" name="f1">
    <select class="selectstyle" name="prjkttype" form="submit">
<?PHP 
    if (isset($projektcheck)) {
        echo"<option value='1'>$projektcheck </option>";    
    } else {
    }  
    if (isset($projektcheckk)) {
        echo"<option value='2'>$projektcheckk </option>";   
    } else {
    }  
?>
    </select>
    <input type=button name=s1 value="Insert" onClick="validateForm()">
</form>
[other codestuff]
nxtfile.php:
<?PHP
session_start();
include ("../connection.php");
$prjkttype=$_POST['prjkttype'];
print($_POST['prjkttype']); 
$checkindb="SELECT * FROM projekte WHERE (projektname = '$prjkttype' )";
$dbcheckk=mysqli_query($con ,$checkindb);
$dbcheckedd=mysqli_fetch_array($dbcheckk);
if($dbcheckedd > 0){
    header ("Location: xy.php");
} else {
    echo "Data is wrong.";
}
?>
 
     
    