I have a web application where a user can change the descriptions of certain events for their use in a tourists android app.
Thing is, as for now, the form has 2 fields, a select type of field with all the events in the database, and a text field where the user writes the new description.
Now, while this is enough, when the app is finished and released to the public, the database will have hundreds of events. So, I thought of making it so there is a 3rd field called "PLACE". And once a place is selected, the select form of the events will change, only showing the events related to the place (Example: Botanic Garden will only show data of the medieval fair and not of, let's say, a play of Hamlet).
¿Is this possible with JS?
This is the code I'm using:
<html>
<head>
<link rel="stylesheet" href="style_form.css">
<script type="text/javascript">
//auto expand textarea
function adjust_textarea(h) {
h.style.height = "20px";
h.style.height = (h.scrollHeight)+"px";
}
</script>
</head>
<body>
ENTRE
<form class="form-style-4" action="update.php" method="post">
<br>
<label for="id"><span>Elija un evento a cambiar</span>
<br>
<select name="id">
<?php
$server = I;
$usuario = WONT;
$pass = SHOW;
$database= THIS;
$mysqli = new mysqli($server, $usuario, $pass, $database);
$query = $mysqli -> query ("SELECT * FROM INFORMACION_EVENTOS");
while ($valores = mysqli_fetch_array($query)) {
echo '<option value="'.$valores[id].'">'.$valores[titulo].'</option>';
}
?>
</select>
<br>
</label>
<label for="descripcion">
<span>Descripcion</span>
<br>
<textarea name="descripcion" onkeyup="adjust_textarea(this)" required="true" placeholder="Max 50 caracteres"></textarea>
</label>
<input type="submit" value="Submit">
</form>
</body>
</html>