Jump to content

Having trouble with "submit" button php function


TWyPGn

Recommended Posts

 

 

<?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 "

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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!!!

Link to comment
Share on other sites

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 by Wickham
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...