rabbitsfeat Posted February 4, 2008 Share Posted February 4, 2008 I have a PHP mail Form on my page that looks like this: <?php if (isset($_REQUEST['email'])) //if "email" is filled out, send email { //send email $email = $_REQUEST['email'] ; $subject = $_REQUEST['subject'] ; $message = $_REQUEST['message'] ; mail( "someone@example.com", "Subject: $subject", $message, "From: $email" ); echo "Thank you for using our mail form"; } else //if "email" is not filled out, display the form { echo "<form method='post' action='mailform.php'> Email: <input name='email' type='text' /><br /> Subject: <input name='subject' type='text' /><br /> Message:<br /> <textarea name='message' rows='15' cols='40'> </textarea><br /> <input type='submit' /> </form>"; } ?> When I fill out the form and submit it I get this error: Not Found The requested URL /mailform.php was not found on this server. Apache/2.0.63 (Win32) PHP/5.2.5 Server at localhost Port 80 On previous advice from another post I've changed the smtp setting in php.ini to read smtp.blueyonder.co.uk instead of localhost—not sure if this has anything to do with PHP Mail Form. Please can someone help? Thank you. Quote Link to comment Share on other sites More sharing options...
haku Posted February 4, 2008 Share Posted February 4, 2008 When people enter information into the form, it attempts to send the information to a file named 'mailform.php', which is supposed to be in the same folder as the form, but apparently isn't. Which is your problem. Quote Link to comment Share on other sites More sharing options...
rabbitsfeat Posted February 4, 2008 Author Share Posted February 4, 2008 What should the contents of mailform.php be and where do I find or get it? Quote Link to comment Share on other sites More sharing options...
rhodesa Posted February 4, 2008 Share Posted February 4, 2008 It looks like you want the form to submit to the same page. So, just remove the action attribute. echo "<form method='post' action='mailform.php'> replace with echo "<form method='post'> Quote Link to comment Share on other sites More sharing options...
rabbitsfeat Posted February 4, 2008 Author Share Posted February 4, 2008 Thanks I'll try that. For the sake of learning and out of interest is mailform.php a script I can download or is it something I need to write myself? Please could you perhaps send me a link or post up here what it should contain. Thank you for all your help. Quote Link to comment Share on other sites More sharing options...
rhodesa Posted February 4, 2008 Share Posted February 4, 2008 This is a great one I use on all my forms: http://www.dtheatre.com/scripts/formmail.php Also, check out this to help fight form spam: http://www.modernblue.com/web-design-blog/fighting-spam-with-css/ Quote Link to comment Share on other sites More sharing options...
rabbitsfeat Posted February 4, 2008 Author Share Posted February 4, 2008 A little confused as to which file I should download from http://www.dtheatre.com/scripts/formmail.php Please could you tell me which and thank you again for all your help. Quote Link to comment Share on other sites More sharing options...
rhodesa Posted February 4, 2008 Share Posted February 4, 2008 Windows: http://www.dtheatre.com/scripts/formmail_files/formmail.v50.zip Linux: http://www.dtheatre.com/scripts/formmail_files/formmail.v50.tar.gz Quote Link to comment Share on other sites More sharing options...
rabbitsfeat Posted February 4, 2008 Author Share Posted February 4, 2008 Thanks. Solved! Quote Link to comment Share on other sites More sharing options...
rabbitsfeat Posted February 4, 2008 Author Share Posted February 4, 2008 Ah actually I still can't get this working. Are there some things I need to edit in the formmail script? It looks like a nightmare to me so please can anyone help me as to what I need to change in the script—I'm very new to all of this. Thanks. Quote Link to comment Share on other sites More sharing options...
rhodesa Posted February 4, 2008 Share Posted February 4, 2008 The documentation is very detailed: http://www.dtheatre.com/scripts/formmail_doc.php Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.