erekthebug Posted September 30, 2013 Share Posted September 30, 2013 I have a simple form on an html page. The collected information should then be e-mailed using a php form handler. I am a designer, not a coder...I cobbled this php together from somewhere. I have no idea why it's not working. Can someone please take a look and help...? I have uploaded the html page and the php page as well...formsend.phprequest.html Quote Link to comment https://forums.phpfreaks.com/topic/282577-php-form-handler-problem/ Share on other sites More sharing options...
Ch0cu3r Posted September 30, 2013 Share Posted September 30, 2013 (edited) I have no idea why it's not working. What do you mean by this? What are expecting the formsend.php to do? What is happening when you submit the form. Any errors shown? Where are you running formsend.php? What have done to try and solve the problem? Edited September 30, 2013 by Ch0cu3r Quote Link to comment https://forums.phpfreaks.com/topic/282577-php-form-handler-problem/#findComment-1451930 Share on other sites More sharing options...
erekthebug Posted September 30, 2013 Author Share Posted September 30, 2013 The information collected from the form should be e-mailed to the address specified in the php form handler. When I hit 'submit,' the php page pops up and says "All fields are required. Please check info and try again." I have no idea where to start...I am not a php coder... Quote Link to comment https://forums.phpfreaks.com/topic/282577-php-form-handler-problem/#findComment-1451934 Share on other sites More sharing options...
Ch0cu3r Posted September 30, 2013 Share Posted September 30, 2013 (edited) Change this line if ((!$email)) to if (!isset($_POST['email'])) This may prevent the All fields required message from showing but it is not checking if all form fields are filled in to your requirements, such as making sure their entered email address is an email address, phone number is in the valid format etc. You need to check each posted value individually and validate each input and make sure it is safe to use. This is called form validation. There are many tutorials that cover this. Edited September 30, 2013 by Ch0cu3r Quote Link to comment https://forums.phpfreaks.com/topic/282577-php-form-handler-problem/#findComment-1451935 Share on other sites More sharing options...
erekthebug Posted September 30, 2013 Author Share Posted September 30, 2013 Change this line if ((!$email)) to if (!isset($_POST['email'])) This may prevent the All fields required message from showing but it is not checking if all form fields are filled in to your requirements, such as making sure their entered email address is an email address, phone number is in the valid format etc. You need to check each posted value individually and validate each input and make sure it is safe to use. This is called form validation. There are many tutorials that cover this. Now we're making progress. It delivered the e-mail...but I only got the e-mail address mailed to me. How do I validate the individual input fields...? Quote Link to comment https://forums.phpfreaks.com/topic/282577-php-form-handler-problem/#findComment-1451937 Share on other sites More sharing options...
Ch0cu3r Posted September 30, 2013 Share Posted September 30, 2013 (edited) This tutorial is a start http://www.sitepoint.com/form-validation-with-php/ If you're using PHP version 5.2 or greater your can use the built in validation/sanitization filters http://www.php.net/manual/en/book.filter.php Edited September 30, 2013 by Ch0cu3r Quote Link to comment https://forums.phpfreaks.com/topic/282577-php-form-handler-problem/#findComment-1451938 Share on other sites More sharing options...
erekthebug Posted September 30, 2013 Author Share Posted September 30, 2013 This tutorial is a start http://www.sitepoint.com/form-validation-with-php/ If you're using PHP version 5.2 or greater your can use the built in validation/sanitization filters http://www.php.net/manual/en/book.filter.php I'm running Dreamweaver CS6...do I have that validation filter capability...? Quote Link to comment https://forums.phpfreaks.com/topic/282577-php-form-handler-problem/#findComment-1451941 Share on other sites More sharing options...
Ch0cu3r Posted September 30, 2013 Share Posted September 30, 2013 (edited) I'm running Dreamweaver CS6...do I have that validation filter capability...? I have no idea? Dreamweaver is good for HTML/CSS etc but when it comes to php code just no. It can do something for you but the code it injects is bloated, not required and makes debugging the php code difficult when the code doesn't work. If you want to code in php click the code/source tab and start coding, dont expect the editor to do everything for you. Stay way from design view when programming your php script. Read the tutorials above, learn the code and try to implement to your script. You'll learn to code much better this way. Edited September 30, 2013 by Ch0cu3r Quote Link to comment https://forums.phpfreaks.com/topic/282577-php-form-handler-problem/#findComment-1451945 Share on other sites More sharing options...
erekthebug Posted September 30, 2013 Author Share Posted September 30, 2013 Thanks...that's pretty much what I've been doing. I grabbed the original php foff of the web, and opened it in code view in Dreamweaver. I'll work my way through the tutorials. Thanks for the help! Quote Link to comment https://forums.phpfreaks.com/topic/282577-php-form-handler-problem/#findComment-1451952 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.