added session

This commit is contained in:
Digi
2024-09-29 08:53:01 +02:00
parent 22c245f14d
commit 6b33de27f0
7 changed files with 37 additions and 13 deletions

View File

@@ -1,14 +1,18 @@
<?php
$valid_input = $_POST['input_text'];
$valid_input = $_SESSION["valid_input"];
if (isset($_POST['input_char'])){
$locations = array();
for ($i=0; $i < strlen($valid_input); $i++) {
if ($_POST['input_char'] == $valid_input[i]){
if ($_POST['input_char'] == $valid_input[$i]){
array_push($locations, $i);
}
}
$_SESSION["locations"] = $locations;
foreach ($_SESSION["locations"] as $key => $value) {
echo "<p>".$_POST['input_char'].": $value </p>";
}
}
echo $locations[0];
}