TWyPGn Posted June 15, 2009 Report Share Posted June 15, 2009 <?php //This is a very simple PHP script that outputs the name of each bit of information (that corresponds to the name attribute for that field) along with the value that was sent with it right in the browser window, and then sends it all to an email address (once you've added it to the script). if (empty($_POST)) { print " No data was submitted.";print " Quote Link to comment Share on other sites More sharing options...
jlhaslip Posted June 15, 2009 Report Share Posted June 15, 2009 Are you trying this on your local machine? If so, you need a Server capable of handling php. Do you have a Server installed? XAMPP or WAMP? If you are using this script on your Web Host, do they allow php? Quote Link to comment Share on other sites More sharing options...
judkels Posted June 16, 2009 Report Share Posted June 16, 2009 I've been strugling over my own php stuff trying to get an email to come back to me. In the end I downloaded xampp to try and practice a bit and eventually got something to work -just the smallest amount of info possible. I tried using your code with xampp and got the following return message which might help you a bit - Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\emailform.php on line 76 I had great difficulty working out what was meant by ini_set() but my hosting service fasthosts (not recomending them if you actually want to speak to someone for support) have quite stringent requirements or the mail won't post so yours may have as well ie they want something along the lines of: ini_set("sendmail_from", $email_from); $sent = mail($email_to, $email_subject, $message, $headers, "-f" .$email_from); they insist you use the "-f" bit. Good luck I hope you get it sorted - I would really be interested to see what you found does work in the end. Quote Link to comment Share on other sites More sharing options...
jlhaslip Posted June 17, 2009 Report Share Posted June 17, 2009 You will need to change some settings in your php.ini file for the XAMPP to work with an SMTP mail function. Xampp has a default page that is orange in colour. Start the XAMPP and then type in http://localhost. Then on the left hand side, select PHP INFO for a listing of the XAMPP settings. Near the top, there is an item which tells you the location of the php .ini file to alter. Google for more information about changing the SMTP settings. I never use the mail feqature on my XAMPP, or I would be of more help to you. Check also at apachefriends.org, in the FAQ section. Quote Link to comment Share on other sites More sharing options...
TWyPGn Posted June 17, 2009 Author Report Share Posted June 17, 2009 Thanks jlhaslip & judkels for replying. Here let me say that I don't know ANYTHING about php. This the first time I am working on a "form". I have made simple html/css webistes with no php or javascript. So I don't know if I need a software or any application to run php. I am total novice in this. I was wondering if submit button php code works when the website is launched, or can one check its working in design phase. I have tried various php codes that send data to an email but nothing has worked. I thought since I haven't launched the website it might not be working properly. If anyone could please explain all the steps that I need to do for this form to work, I'll be very grateful. Please help!!! Quote Link to comment Share on other sites More sharing options...
Wickham Posted June 18, 2009 Report Share Posted June 18, 2009 (edited) I always test my email forms by uploading to my host and filling in details to myself with another of my email addresses. If it doesn't work, at least I can't get spam! If you are worried about your page being online while not working properly, give it a temporary filename that isn't linked from any other page on your website. It's unlikely then that anyone will find it. Edited June 18, 2009 by Wickham 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.
Note: Your post will require moderator approval before it will be visible.