I explain if when creating this website, I select a table:
Table sr_productos
id nombre_esp
1 NombreA
2 NombreB
3 NombreC
4 NombreD
the id 1 who in the textarea part marks the result of immediate in the variable:
$id_producto2
The detail is that I do not know how to do it, I imagine it is with an Include or a Require if someone helps me thank you
<?php
include "../../includes/db_connect2.php";
include "../../includes/db_connect_mysql.php";
$id_producto2 = $_POST['id_producto2'];
if (isset($_POST['submit'])) {
if (empty($_POST['id_producto2'])) {die('no ingresastes tu ID de GM!');}
}
?>
<html>
<head>
<title>web-Mall</title>
<script src="../../includes/ckeditor/ckeditor.js"></script>
</head>
<body>
<center>
<br><br>
<h2>Agregar Items a la Web Mall</h2>
<form action="<?php
echo $_SERVER['PHP_SELF'];
?>" method="POST">
<?php
$sql = mysqli_query($conexion,'
select * from sr_productos WHERE precio = 0 and estado = \'ACTIVO\'
');if (mysqli_num_rows($sql) > 0)
{echo"Elija Premio 2: <select required name='id_producto2' >\n";
print"<option value=''>-------------***************Elija una Opcion******************-----------</option>\n";
while ($temp = mysqli_fetch_array($sql))
{
print"<option value='".$temp["id"]."'>".$temp["nombre_esp"]."</option>\n";
}
echo" </select>\n"; }else{ echo"No hay datos"; } mysqli_free_result($sql);
?>
<textarea><?php $id_producto2 ?></textarea><!--Aqui quiero que muestre el resultado del Select sr_productos instantaneamente osea que si seleciono NombreB deberia aparecer aqui 2 al instante-->
<p><input type="submit" value="Confirma" name="submit" /></p>
</form>
</center>
</body>
</html>