Buongiorno a tutti.
Ho due pagine.
La prima pagina1.php?nome=paolo
la seconda riceve dei dati dalla prima.
Vorrei che qualcino mi dicesse se il modo che ho utilizzato per risolvere questo problema basilare e terra a terra è quello giusto o se ne esiste uno più consono a php.
Il post della pagina1.php
<?php
if ($_POST['action'] == "post") {
echo $nome;
if (empty($nome)) {
$goto='error.php?nome='.$nome';
?>
<script language="javascript">document.location.href="<?=e rror.php?>";</script>
<?php
}
else
{
$goto='prova2.php?nome='.$nome;
?>
<script language="javascript">document.location.href="<?=$ goto?>";</script>
<?php
}
}
?>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form action="" method="post" name="prova1">
<input name="action" type="hidden" value="post">
<?php
?>
<table width="400" border="1" align="center" cellspacing="0">
<tr>
<td width="169"><html> <input type="text" name="nome">
<td width="169"></tr>
<tr>
<td><input type="text" name="indirizzo"></td>
<td><input type="submit" name="Submit" value="VAI"></td>
</tr>
</table>
</form>
</body>
</html>
Il post della pagina 2
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
torna
<form action="" method="post">
<table width="400" border="0" cellspacing="0">
<tr>
<td> <input name="nomex" type="text" value="<?php echo $_REQUEST['nome'];?>">
</td>
<td></td>
</tr>
</table>
</form>
</body>
</html>
in questo modo ricevo correttamente i dati nella pagina due.
Se mi poteste dare un giudizio ve ne sari molto grato.
Grazie e buon lavoro.