I discovered how it does, without the need for ajax, javascript, table and others. I'll explain by example. I made the whole square array dynamic interface in the "index.php" file.
First, I put the field that should update the interface. Using <form action="index.php" method="post">
, entry by field <input name="numeroDeEquações" type="text" />
will reopen the page "index.php" with variable $_POST['numeroDeEquações']
updated with the value that was passed in the field.
The second and final step is to determine the interface according to the value of the field. To do this, first check that $_POST['numeroDeEquações']
has been set. Then I check if the value is valid. According to the conditions, the interface is built.
Simple like that. Follow the code and thank everyone who tried to help.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Matriz Quadrada</title>
</head>
<body>
<form action="index.php" method="post">
Ordem:    <input name="numeroDeEquações" type="text" /><br />
</form>
<?php
$inválido = true ;
if( isset($_POST['numeroDeEquações']) ){
$numeroDeEquações = $_POST['numeroDeEquações'] ;
if( $numeroDeEquações>1 && $numeroDeEquações<10 ){
$inválido = false ;
for( $índice1=0 ; $índice1<$numeroDeEquações ; $índice1++ ){
for( $índice2=0 ; $índice2<$numeroDeEquações ; $índice2++ ){
echo( "<input size=1 type='text' />" ) ;
}
echo( "<br>" ) ;
}
}
}
if( $inválido ) echo( "<br>Forneça um número de 2 a 9." ) ;
?>
</body>
</html>