simple form post problem
-
First time creating a theme from scratch.
I’ve built a form (simple one):
<form name="cform" method="post" action="<?php echo bloginfo('template_directory') . '/contact-form.php' ?>"> <fieldset> <input id="cname" name="cname" type="text" value="Name" /> <input id="cemail" name="cemail" type="text" value="Email" /> <input id="cphone" name="cphone" type="text" value="Phone" /> <textarea id="cmessage" name="cmessage" rows="6" cols="33">Message</textarea> <button id="submit" type="submit" name="submit">Send</button> </fieldset> </form>
PHP I’m using to process the form:
<?php if(isset($_POST['submit'])) { $to = "[email protected]"; $subject = "Capital Care Contact Form"; $name_input = $_POST['cname']; $email_input = $_POST['cemail']; $phone_input = $_POST['cphone']; $message = $_POST['cmessage']; $body = "From: $name_input\n E-Mail: $email_input\n Phone: $phone_input\n Message:\n $message"; echo "Data has been submitted to $to!"; mail($to, $subject, $body); } else { echo "blarg!"; } ?>
I don’t know why but when I submit a test form I get a 404 the page cannot be found error.
Any ideas why WordPress thinks the file is missing?
Thanks.
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘simple form post problem’ is closed to new replies.