0
I’m making some basic algorithms with php, and so of curiosity I decided to make an html with a form
, input text
and a button to send. in PHP.
If the variable I put in input text
is equal to 1, php displays another form below.
I tried to type something in this input text and send, but nothing happened, even though I had created an algorithm that would display the number on the screen.
Follows the code:
<html>
<head><font face="Arial">
</head>
<body>
<form method="POST">
Valor:<input type="text" name="n1"><br>
<input type="submit" name="Enviar" value="Enviar"></form>
<input type="hidden" name="n2" value="0">
<body>
<?php
if(isset($_POST['n1']) || isset($n1))
{
if(isset($_POST["valor1"]))
{
$n1=$_POST['valor1'];
}
else
{
$n1 = $_POST['n1'];
}
if(isset($_POST["valor2"]))
{
$n2=$_POST['valor2'];
}
else
{
$n2 = $_POST['n2'];
}
if($n1 == 1)
{
echo '<form method="POST">Valor:<input type="text" name="n2"><br>
<input type="submit" name="Enviar" value="Enviar"></form>
<input type="hidden" name="valor1" value="'.$n1.'">
<input type="hidden" name="valo2" value="'.$n2.'">';
}
if(isset($_POST['n2']) || isset($n2))
{
echo $n2;
}
}
?>
</html>
I cannot identify the variable of
textarea
, I haven’t even found a textarea, explains a little more about your doubt and checks if this is all in the example– Leonardo Barros
Sorry, I got confused
text area
withinput text
. And I wonder if there’s any way to create aform
from the php that works– riki481
which can be read by the algorithm and which displays its value on the screen
– riki481