Hi, I want to know how I can do that every time I select a select option it is added to a textarea, when I select an option it shows me this in textarea
Notice : Undefined index: id in C: \ xampp \ htdocs \ Login16 \ Login \ view \ edit.php on line 130
<form>
<?php
$query_mostrar_tema = "SELECT * FROM materiales";
$mostrar_tema = mysqli_query($conexion,$query_mostrar_tema ) or die(mysqli_error());
$row_mostrar_tema = mysqli_fetch_assoc($mostrar_tema);
$totalRows_mostrar_tema = mysqli_num_rows($mostrar_tema);
?>
<select id="tema" name="tema" onChange="actualizar()">>
<?php do { ?>
<option value="<?php echo $row_mostrar_tema['id']?>"><?php echo $row_mostrar_tema['nombre']?>
</option>
<?php
} while ($row_mostrar_tema = mysqli_fetch_assoc($mostrar_tema));
$rows = mysqli_num_rows($tema);
if($rows > 0) {
mysqli_data_seek($tema, 0);
$row_mostrar_tema = mysqli_fetch_assoc($tema);
}
?>
</select>
<script language="javascript">
var datos = [];
function actualizar() {
var select = document.querySelector('#tema').value;
var eltexto = document.querySelector('#eltexto');
datos.push(select);
eltexto.value = datos;
}
</Script>
<br>
<textarea id="eltexto" rows="10" cols="40"></textarea>
</form></div>