Here's the form:
HTML
<form action="skriptit/sivupalauteskripti.php" method="post">
<b>Nimi:</b> <br> <input type="text" name="nimi"> <br> <!-- This is the name input text area -->
<b>Sähköposti:</b> <br> <input type="text" name="sposti"> <br> <!-- This is e-mail input -->
<b>Palaute:</b> <br><textarea name="palaute"> <!-- Another text area for comments -->
</textarea> <br>
<input type="submit" value="Lähetä palaute"> <!-- The submit button -->
</form>
<b>Nimi:</b> <br> <input type="text" name="nimi"> <br> <!-- This is the name input text area -->
<b>Sähköposti:</b> <br> <input type="text" name="sposti"> <br> <!-- This is e-mail input -->
<b>Palaute:</b> <br><textarea name="palaute"> <!-- Another text area for comments -->
</textarea> <br>
<input type="submit" value="Lähetä palaute"> <!-- The submit button -->
</form>
And the php script:
CODE
<?php
//I don't know how to explain this on English, you should get what this does after a few looks :D "nimi" is the name and "arvo" is value, I think something is wrong with them but I don't know what!
foreach($_POST as $nimi => $arvo) {
$palaute .= $nimi . ": " . $arvo . "\n";
}
//Send the comment to email by php "mail" function
$viesti = mail("my-email@myemail.com", "Palaute", $palaute);
//$viesti is true when email is sent succesfully
if($viesti) {
//when sent succesfully, it redirects to the thank you page
header("Location: ../kiitos.php");
} else {
//If not, it will redirect to the error page
header("Location: ../virhe.php");
}
?>
//I don't know how to explain this on English, you should get what this does after a few looks :D "nimi" is the name and "arvo" is value, I think something is wrong with them but I don't know what!
foreach($_POST as $nimi => $arvo) {
$palaute .= $nimi . ": " . $arvo . "\n";
}
//Send the comment to email by php "mail" function
$viesti = mail("my-email@myemail.com", "Palaute", $palaute);
//$viesti is true when email is sent succesfully
if($viesti) {
//when sent succesfully, it redirects to the thank you page
header("Location: ../kiitos.php");
} else {
//If not, it will redirect to the error page
header("Location: ../virhe.php");
}
?>
Edit: I would also like to know if I can do this in another way without the spam bots picking out my e-mail address


