Hello, I encountered such a problem: <select> displays information from the database, selecting it, we follow the link to the def. the page on which this select is also installed, but the first selection line is displayed again, and not the one (the name of the page) where we are at the moment, how can this be corrected?
Form Code:
<form name="seria_name" method="POST" action="/template/seria_redirect.php">';?> <select name="seria_name" onchange="document.forms.seria_name.submit();return false"> <?php $query_seria = mysqli_query($dbc, "SELECT seria_name, id_seria FROM serias WHERE id_sezon = '$id_sezon'"); while ($row_seria = mysqli_fetch_array($query_seria)) { echo ' <option value="' . $row_seria['id_seria'] . '">' . $row_seria['seria_name'] . '</option>'; } echo '</select> </form>'; Handler Code:
if (isset($_POST['seria_name'])) { $id_seria = mysqli_real_escape_string($dbc, trim($_POST['seria_name'])); $query_seria = mysqli_query($dbc, "SELECT id_sezon, id_serial FROM serias WHERE id_seria = '$id_seria'"); $row_seria = mysqli_fetch_array($query_seria); $id_sezon = $row_seria['id_sezon']; $id_serial = $row_seria['id_serial']; header('Location: /index.php?id=' . $id_serial . '&id_sezon=' . $id_sezon . '&id_seria=' . $id_seria); }