- 3 Gennaio 2012
- 178
- 0
- Miglior risposta
- 0
Io ho questo GuestBook:
Home:
Send:
Allora, io vorrei che quando un utente posta una cosa il messaggio non arrivi nella home, ma in un altro file che si chiamerà index, cosa devo cambiare ?
Home:
<html>
<head>
<title>Guestbook</title>
</head>
<body>
<?php
include ("msg.txt");
?>
<div id="msg">
<form action="send.php" method="post">
Username : <input type="text" id="username" name="username" /><br />
Titolo: <input type="text" id="titolo" name="titolo" /></textarea><br /> <br />
News: <br /> <textarea name="messaggio" rows="10" cols="30"></textarea><br /> <br />
<input type="submit" value="Invia">
<input type="reset" value="Cancella">
</form>
</div>
</body>
</html>
Send:
<?php
$utente=htmlspecialchars($_POST['username']);
$messaggio=htmlspecialchars($_POST['messaggio']);
$titolo=htmlspecialchars($_POST['messaggio']);
$msg= "msg.txt";
if ($utente=="") {
echo "Inserisci username";
} elseif ($messaggio=="") {
echo "Inserisci un messaggio";
} else {
$guestbook = fopen($msg,"a");
$txt='<div id="msg"><font size=”4″><font color="red"><b>Utente: '.$utente.'<br /><br />';
$txt .='Titolo: '.$titolo. '<br /><br />';
$txt .='Messaggio: '.$messaggio. '<br /><br />';
fwrite($guestbook, $txt);
fclose($guestbook);
echo '<a href="/GuestBook/home.php">Torna alla home</a>';
}
?>
Allora, io vorrei che quando un utente posta una cosa il messaggio non arrivi nella home, ma in un altro file che si chiamerà index, cosa devo cambiare ?