[SOLVED] Wordpress contact form - getting 404 on send

This is a discussion on "[SOLVED] Wordpress contact form - getting 404 on send" within the PHP Forum section. This forum, and the thread "[SOLVED] Wordpress contact form - getting 404 on send are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jan 24th, 2008, 22:07
Aso's Avatar
Aso Aso is offline
Chief Moderator

SuperMember
Join Date: Oct 2007
Location: UK
Posts: 1,012
Blog Entries: 2
Thanks: 5
Thanked 23 Times in 20 Posts
Send a message via Skype™ to Aso
[SOLVED] Wordpress contact form - getting 404 on send

Hi All

Another Wordpress question I know(!)

I'm using

PHP: Select all

<?php if(isset($_POST['submit'])) {

// Run processing

if (@mail($recipient$subject$msg) {

// send email otherwise output error

}
}
?>
followed by
Code: Select all
<form method="post" action="/contact/">
<!--form inputs-->
</form>
If my form doesn't validate (i.e missing or invalid inputs) the PHP returns the form fine with the appropriate errors I've configured and the values retained in the input boxes etc.

But as soon as it's actually ready to 'mail', I get a 404!? I've used this form in the past fine, but I wondered if there was anything that could interfere with the Wordpress core?

Ideally I want to code my own and not use a plugin - thing is, the various form plugins work fine and I can't work out where I'm going wrong.
Last Blog Entry: The Google Misconception (Feb 3rd, 2008)
Reply With Quote

  #2 (permalink)  
Old Jan 25th, 2008, 03:30
Rakuli's Avatar
SuperMember

SuperMember
Join Date: Sep 2007
Location: Australia
Age: 24
Posts: 956
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Wordpress contact form - getting 404 on send

You're missing a parenthesis in your if statement.

if (@mail($recipient, $subject, $msg)

should be

if (@mail($recipient, $subject, $msg))
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
Reply With Quote
  #3 (permalink)  
Old Jan 25th, 2008, 09:24
Aso's Avatar
Aso Aso is offline
Chief Moderator

SuperMember
Join Date: Oct 2007
Location: UK
Posts: 1,012
Blog Entries: 2
Thanks: 5
Thanked 23 Times in 20 Posts
Send a message via Skype™ to Aso
Re: Wordpress contact form - getting 404 on send

Sorry Rakuli, that's a typo in the post. The script is working fine, but for some reason (when it comes to sending) Wordpress throws a 404 at me.

I read somewhere about using a mail function defined in the Wordpress core - anyone know about this?
Last Blog Entry: The Google Misconception (Feb 3rd, 2008)
Reply With Quote
  #4 (permalink)  
Old Jan 25th, 2008, 11:23
Aso's Avatar
Aso Aso is offline
Chief Moderator

SuperMember
Join Date: Oct 2007
Location: UK
Posts: 1,012
Blog Entries: 2
Thanks: 5
Thanked 23 Times in 20 Posts
Send a message via Skype™ to Aso
Re: Wordpress contact form - getting 404 on send

BUG I just ran a quick test and everything was A OK. Seems like I'm going to have to do a bit of a rewrite


EDIT: After further debugging, I think it was down to using variables that conflicted with the Wordpress core. So just for anyone in the same situation, make sure you're using unique variables!!
Last Blog Entry: The Google Misconception (Feb 3rd, 2008)

Last edited by Aso; Jan 25th, 2008 at 11:50.
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] PHP contact form problem fl0w PHP Forum 12 Jan 31st, 2008 17:56
[SOLVED] PHP contact form redirect to same form Posie PHP Forum 14 Jan 29th, 2008 20:28
[SOLVED] PHP Contact Form Stuart PHP Forum 8 Dec 4th, 2007 17:42
[SOLVED] Contact Form Help danny322 PHP Forum 3 Nov 7th, 2007 16:05
[SOLVED] PHP Contact Form Stuart PHP Forum 9 Oct 20th, 2007 00:48


All times are GMT. The time now is 20:40.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43