I have some problem making my contact form work. The contact form should only be in one simple site. So i created two templates. The first template only has the form. The other one have the php code to send a mail. But i cant make the form contact the other template
Here is the first template
<?php
/*
Template Name: Contact 1
*/
?>
<?php get_header(); ?>
<div id="content-container">
<div id="content" role="main">
<form method="post" action="http://www.sbk-sm.se/lydnad-agility.2012/index.php/kontakt-2">
Namn:
<br />
<input type="text" name="name" />
<br />
Email:<br />
<input type="email" name="email" />
<br /> <br />
Till:
<select name="mailTo">
<option value="adibbinhaider@gmail.com">Ex2 Mail</option>
<option value="">Ex2 Mail</option>
</select>
<br /><br />
Meddelende:<br/>
<textarea name="msg"></textarea>
<input type="submit" value="Skicka" name="submit">
</form>
</div><!-- #content -->
</div><!-- #content-container -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
Here is the second template
<?php
/*
Template Name: Contact 2
*/
?>
<?php
if($_POST["name"] != "")
{
echo "Medelende har skickats ";
$name = $_POST["name"];
$emailFrom = $_POST["email"];
$mailTo = $_POST["mailTo"];
$msg = "FrÄn: \n";
$msg .= "Namn: " .$name;
$msg .= "\nE-Mail: " .$emailFrom;
$msg .= "\n\n";
$msg .= "Till: \n";
$msg .= $mailTo;
$msg .= "\n\n";
$msg .= "Meddelnde: \n";
$msg .= $_POST["msg"];
$msg .= "\n\n";
$subject = utf8_decode("SM Lydnad & Agility 2012 KontaktformulÀr");
$headers = utf8_decode("From: " .$emailFrom."\r\n");
mail($mailTo, $subject, utf8_decode($msg), $headers);
}
?>
So I cant get to the second template, WP says the site doesnt exists