<?php

$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]){
            array_push($locations, $i);
        }
    }
    $_SESSION["locations"] = $locations;

    foreach ($_SESSION["locations"] as $key => $value) {
        echo "<p>".$_POST['input_char'].": $value </p>";
    }
}

