THe code below does not work. This is the code inside my contact page (page-kontakt.php) :
<h4>Send Us Mail</h4><br/>
<?php
if ($_GET[msg_sent]=='true' ) {
echo '<div>Your message has been sent!</div>';
}elseif ($_GET[msg_sent]=='false') {
echo '<div>An error occurred sending your message.</div>';
}else{
?>
<form method="post" action="<?php echo LEARNINGWORDPRESS_THEME_URL ?>functions.php">
<label>Name</label>
<input name="name" placeholder="Type Here">
<label>Email</label>
<input name="email" type="email" placeholder="Type Here">
<label>Message</label>
<textarea name="message" placeholder="Type Here"></textarea>
<label>*What is 2+2? (Anti-spam)</label>
<input name="human" placeholder="Type Here">
<input id="submit" name="submit" type="submit" value="Submit">
</form>
<?php } ?>
This is the code inside my functions page (functions.php) :
// KONTAKT - MESSAGE SENDING FUNCTIONS FOR page-kontakt.php
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$from = 'From: http://muzykablog.pl/';
$to = 'piterdeja@gmail.com';
$subject = 'Hello';
$human = $_POST['human'];
$body = "From: $name
E-Mail: $email
Message:
$message";
if(mail($to, $subject, $body, $from)){
header('Location:page-kontakt.php?msg_sent=true');
}else{
header('Location:page-kontakt.php?msg_sent=false');
}
In my wordpress site I want to be able to enter muzykablog.pl/kontakt where my contact form is (right now url muzykablog.pl/kontakt does not work) and after filling all the input windows like 'email' 'message' and clicking 'submit' I want to receive email message to the email address which I specified. Notice that I specified absolute path:
<form method="post" action="<?php echo LEARNINGWORDPRESS_THEME_URL ?>functions.php">
Maybe it is necessary to specify absolute path in
Location:page-kontakt.php?msg_sent=true
...as well, but how to specify absolute path in functions.php ?