19 noviembre, 2020
Enviar y Recibir variables en PHP
Para enviar y recibir una variable usando formularios en PHP y HTML, es necesario usar métodos post o get y almacenarlos en variables PHP

Suscríbete a nuestro canal en Youtube
SuscríbirsePara enviar y recibir una variable usando formularios en PHP y HTML, es necesario usar métodos post o get y almacenarlos en variables PHP.
Envia y Recibe variables en PHP entre dos páginas
Página que envia un request (parámetros) en PHP
index.php
<form action="recibe.php" method="post">
<input type="text" name="txtmensaje" placeholder="Ingrese mensaje" required > <br>
<input type="text" name="txtnombre" placeholder="Ingrese nombre" required > <br>
<input type="submit" name="btnenviar" value="ENVIAR MENSAJE">
</form>
Página destino que recibe los parámetros y los muestra
recibe.php
<?php
if(isset($_POST['btnenviar'])){
$m = $_POST['txtmensaje'];
$n = $_POST['txtnombre'];
}
?>
<form action="recibe.php" method="get">
<input type="text" name="txtmensaje2" value="<?php echo $m . " ". $n ?>">
</form>
Leido 11318 veces | 0 usuarios
Código fuente no disponible.