I updated my website with a new contact form and for some reason when I click on the SUBMIT button, it doesn't work. I have had several people try with no luck with the exception of the creator of the contact page who is stumped as well. If anyone has any suggestions, I would greatly appreciate it. I am VERY new to coding so please keep that in mind when reading this and if you respond :) Thanks!!
Here is what I have for my contact.php file.... - <?php
-
-
$name = $HTTP_POST_VARS['Name'];
-
$email = $HTTP_POST_VARS['Email'];
-
$message = $HTTP_POST_VARS['Message'];
-
$phone = $HTTP_POST_VARS['Phone'];
-
-
$message = stripslashes($message);
-
-
$sendTo = "I inserted my email address here";
-
$subject = "Message from Web Site";
-
-
$msg_body = "Name: $name\n";
-
$msg_body .= "E-Mail: $email\n";
-
$msg_body .= "Comments: $message\n";
-
$msg_body .= "Phone: $phone\n";
-
-
$header_info = "From: ".$name." <".$email.">";
-
-
mail($sendTo, $subject, $msg_body, $header_info);
-
-
?>
[Please use CODE tags when posting source code. Thanks! --pbmods] 27 5141
I updated my website with a new contact form and for some reason when I click on the SUBMIT button, it doesn't work. I have had several people try with no luck with the exception of the creator of the contact page who is stumped as well. If anyone has any suggestions, I would greatly appreciate it. I am VERY new to coding so please keep that in mind when reading this and if you respond :) Thanks!!
Here is what I have for my contact.php file....
<?php
$name = $HTTP_POST_VARS['Name'];
$email = $HTTP_POST_VARS['Email'];
$message = $HTTP_POST_VARS['Message'];
$phone = $HTTP_POST_VARS['Phone'];
$message = stripslashes($message);
$sendTo = "I inserted my email address here";
$subject = "Message from Web Site";
$msg_body = "Name: $name\n";
$msg_body .= "E-Mail: $email\n";
$msg_body .= "Comments: $message\n";
$msg_body .= "Phone: $phone\n";
$header_info = "From: ".$name." <".$email.">";
mail($sendTo, $subject, $msg_body, $header_info);
?>
Question:
Where are you send your input (data) to ie database e-mail, spread sheet.
nomad
Question:
Where are you send your input (data) to ie database e-mail, spread sheet.
nomad
This script was designed by someone else (the person I purchased the web template for my site from) so from what little I know, I believe it goes to email.
Unfortunately, the creator of the script has no idea why when she tests it it works for her but when I try it it doesn't.
Changed thread title to remove ALL CAPS.
Unfortunately, the creator of the script has no idea why when she tests it it works for her but when I try it it doesn't.
When she tries it, is she connecting to the same server as you are? In other words, when she tests it, is she using her own personal server, but when you test it, you're using your server instead?
It sounds like the mail function is having problems. Check out this thread to debug the problem.
maybe the smtp server u are trying to use is wrong and/or there is no from.
if u can access the the php.ini, change:
on line 689 (php-5.2.3-Win32)
smtp = your_smtp
and
online 693 (php-5.2.3-Win32)
sendmail_from = me@example.com
**there might be a semi-colon (;) there, remove it
if u can't access the php.ini, add this at the top of your code:
[PHP]
ini_set("smtp", "your_smtp");
ini_set("sendmail_from", "me@example.com");
[/PHP]
**items in italic must be changed
hopefully that does the trick, let me know.
I updated my website with a new contact form and for some reason when I click on the SUBMIT button, it doesn't work. I have had several people try with no luck with the exception of the creator of the contact page who is stumped as well. If anyone has any suggestions, I would greatly appreciate it. I am VERY new to coding so please keep that in mind when reading this and if you respond :) Thanks!!
Here is what I have for my contact.php file.... - <?php
-
-
$name = $HTTP_POST_VARS['Name'];
-
$email = $HTTP_POST_VARS['Email'];
-
$message = $HTTP_POST_VARS['Message'];
-
$phone = $HTTP_POST_VARS['Phone'];
-
-
$message = stripslashes($message);
-
-
$sendTo = "I inserted my email address here";
-
$subject = "Message from Web Site";
-
-
$msg_body = "Name: $name\n";
-
$msg_body .= "E-Mail: $email\n";
-
$msg_body .= "Comments: $message\n";
-
$msg_body .= "Phone: $phone\n";
-
-
$header_info = "From: ".$name." <".$email.">";
-
-
mail($sendTo, $subject, $msg_body, $header_info);
-
-
?>
[Please use CODE tags when posting source code. Thanks! --pbmods]
What do you mean by "when I click on the SUBMIT button, it doesn't work"?
What actually happens when you click the submit button?
Does it not do anything at all?
Do you got to the next page, but the it is blank?
Does it go to the next page, but you don't get an email with results?
Do you get an error?
Also, the use of "$HTTP_POST_VARS" is deprecated since PHP4.1+. Use $_POST instead.
maybe the smtp server u are trying to use is wrong and/or there is no from.
if u can access the the php.ini, change:
on line 689 (php-5.2.3-Win32)
smtp = your_smtp
and
online 693 (php-5.2.3-Win32)
sendmail_from = me@example.com
**there might be a semi-colon (;) there, remove it
if u can't access the php.ini, add this at the top of your code:
[PHP]
ini_set("smtp", "your_smtp");
ini_set("sendmail_from", "me@example.com");
[/PHP]
**items in italic must be changed
hopefully that does the trick, let me know.
Thanks for the help. I can't access the php.ini so I added to the code in the contact.php Either it didn't work or I did't input it correctly. Here is what I did... -
<?php
-
-
ini_set("smtp", "your_smtp");
-
ini_set("sendmail_from", "my email");
-
$name = $HTTP_POST_VARS['Name'];
-
$email = $HTTP_POST_VARS['Email'];
-
$message = $HTTP_POST_VARS['Message'];
-
$phone = $HTTP_POST_VARS['Phone'];
-
-
$message = stripslashes($message);
-
-
$sendTo = "my email";
-
$subject = "Message from Web Site";
-
-
$msg_body = "Name: $name\n";
-
$msg_body .= "E-Mail: $email\n";
-
$msg_body .= "Comments: $message\n";
-
$msg_body .= "Phone: $phone\n";
-
-
$header_info = "From: ".$name." <".$email.">";
-
-
mail($sendTo, $subject, $msg_body, $header_info);
-
-
?>
Changed thread title to remove ALL CAPS.
When she tries it, is she connecting to the same server as you are? In other words, when she tests it, is she using her own personal server, but when you test it, you're using your server instead?
It sounds like the mail function is having problems. Check out this thread to debug the problem.
\
I am not sure if she uses th same server..doubt it. I will look into this though. Thanks.
What do you mean by "when I click on the SUBMIT button, it doesn't work"?
What actually happens when you click the submit button?
Does it not do anything at all?
Do you got to the next page, but the it is blank?
Does it go to the next page, but you don't get an email with results?
Do you get an error?
Also, the use of "$HTTP_POST_VARS" is deprecated since PHP4.1+. Use $_POST instead.
When I click the submit button, the button "blinks" but there is no cosequence..the page stays the same..nothing changes..the information is still on the form...no errors. And the reset button works to clear the form.
I tried$_POST and no luck,
Thanks though.
\
I am not sure if she uses th same server..doubt it. I will look into this though. Thanks.
I tried the debugging suggestions and no luck either. thanks though.
info.php
[PHP]<?php
phpinfo();
?>
[/PHP]
create this file and put it to your web server root and execute.
http://www.yourdomain.com/info.php
and please submit the configuration settings here for smtp settings from the page you getting.
info.php
[PHP]<?php
phpinfo();
?>
[/PHP]
create this file and put it to your web server root and execute.
http://www.yourdomain.com/info.php
and please submit the configuration settings here for smtp settings from the page you getting.
I hope I am giving you the right info...let me know otherwise. Thanks!
SMTP localhost localhost
smtp_port 25 25
I hope I am giving you the right info...let me know otherwise. Thanks!
SMTP localhost localhost
smtp_port 25 25
- If you are using a purchased web hosting package from a vendor and if you execute this info.php file under that location your SMTP setting might be correct.
- but if you used your local machine web server to execute this info.php file, this SMTP configuration is not valid.you have to use a SMTP server under your local host.
let me know which one was yours from those two.
- If you are using a purchased web hosting package from a vendor and if you execute this info.php file under that location your SMTP setting might be correct.
- but if you used your local machine web server to execute this info.php file, this SMTP configuration is not valid.you have to use a SMTP server under your local host.
let me know which one was yours from those two.
I believe (from the best of my limited konwledge) that I used my local machine web server. I did purchase this package from a vendor but I use my server to access the info.
I believe (from the best of my limited konwledge) that I used my local machine web server. I did purchase this package from a vendor but I use my server to access the info.
Normally if you purchased a web hosting package with php support by default php mail facility is available. but sometimes they might disable it. you have to verify it with your service provider.
Since you are trying this local machine web server (no doubts php is working,since it has executed this info.php file) you have to configure your php.ini file to work with php mail.
Find the php.ini file from your php root dir.
if you are on a windows box you can locate it under C:\WINDOWS or under your php installation dir.
Hint: use the system search tool to locate it.
then open it using a text editor, find this line.and enter your smtp host name -
SMTP = mail.somehost.com
-
smtp_port = 25
You have to use a smtp server address and port here.if you are using a outlook or some kind of mail client in your box. use the smtp of that.
Normally if you purchased a web hosting package with php support by default php mail facility is available. but sometimes they might disable it. you have to verify it with your service provider.
Since you are trying this local machine web server (no doubts php is working,since it has executed this info.php file) you have to configure your php.ini file to work with php mail.
Find the php.ini file from your php root dir.
if you are on a windows box you can locate it under C:\WINDOWS or under your php installation dir.
Hint: use the system search tool to locate it.
then open it using a text editor, find this line.and enter your smtp host name -
SMTP = mail.somehost.com
-
smtp_port = 25
You have to use a smtp server address and port here.if you are using a outlook or some kind of mail client in your box. use the smtp of that.
I attempted to find the php.ini file with no luck (I am working on a Mac OSX).
I even used the search tool to find it. The only php file I can access is the contact.php file that is listed in the above postings. I tried inputing the coding into the php.ini file and it didn't work. I am stumped and frustrated. My limited knowledge makes it even more frustrating. I really appreciate your help and patience. Thanks!!!
I attempted to find the php.ini file with no luck (I am working on a Mac OSX).
I even used the search tool to find it. The only php file I can access is the contact.php file that is listed in the above postings. I tried inputing the coding into the php.ini file and it didn't work. I am stumped and frustrated. My limited knowledge makes it even more frustrating. I really appreciate your help and patience. Thanks!!!
Since you executed the phpinfo script i believe that php engine is running under your web server.Problem is with the mail() function its not configured to send a mail.
As you posted before still your smtp server address localhost.
that means you can't send a mail with these settings.
We'll try to fix it from application level instead of changing the php.ini file.
Add these lines to the beginning of your mail script with keeping this configured as here, - Make sure to replace mail.yourdomain.com with existing smtp server address.
- port is normally 25 by default. but verify it with your SMTP provider
- <?php
-
ini_set("smtp","mail.yourdomain.com");
-
ini_set("smtp_port","25");
-
ini_set("sendmail_from","fromYou@yourdomain.com");
-
-
# Rest of the code for email script
-
#
-
#
-
?>
Since you executed the phpinfo script i believe that php engine is running under your web server.Problem is with the mail() function its not configured to send a mail.
As you posted before still your smtp server address localhost.
that means you can't send a mail with these settings.
We'll try to fix it from application level instead of changing the php.ini file.
Add these lines to the beginning of your mail script with keeping this configured as here, - Make sure to replace mail.yourdomain.com with existing smtp server address.
- port is normally 25 by default. but verify it with your SMTP provider
- <?php
-
ini_set("smtp","mail.yourdomain.com");
-
ini_set("smtp_port","25");
-
ini_set("sendmail_from","fromYou@yourdomain.com");
-
-
# Rest of the code for email script
-
#
-
#
-
?>
Thanks for sticking with me on this. I tried what you told me with no luck. I am seriously ready to pull out my hair. I know there is an answer and it is just frustrating me that I can't figure it out. I am afraid that I may be inputing your suggestions wrong so I have pasted what I have last inputed below.
<?php
ini_set("smtp","smtpauth.earthlink.net");
ini_set("smtp_port","25");
ini_set("sendmail_from","fromme@earthlink.net");
$name = $HTTP_POST_VARS['Name'];
$email = $HTTP_POST_VARS['Email'];
$message = $HTTP_POST_VARS['Message'];
$phone = $HTTP_POST_VARS['Phone'];
$message = stripslashes($message);
$sendTo = "me@earthlink.net";
$subject = "Message from Web Site";
$msg_body = "Name: $name\n";
$msg_body .= "E-Mail: $email\n";
$msg_body .= "Comments: $message\n";
$msg_body .= "Phone: $phone\n";
$header_info = "From: ".$name." <".$email.">";
mail($sendTo, $subject, $msg_body, $header_info);
?>
Are you getting any error messages back from this script? Have you enabled error reporting as the top post in this forum describes?
Thanks for sticking with me on this. I tried what you told me with no luck. I am seriously ready to pull out my hair. I know there is an answer and it is just frustrating me that I can't figure it out. I am afraid that I may be inputing your suggestions wrong so I have pasted what I have last inputed below.
### CODE REMOVED - Ajaxrand
Motoma is expecting something like this, give it a try.
As i remember u failed to edit your php.ini, but this ini_set ( string $varname, string $newvalue ) is an alternative for that. -
<?php
-
error_reporting(E_ALL);
-
ini_set('display_errors', True);
-
ini_set("smtp","smtpauth.earthlink.net");
-
ini_set("smtp_port","25");
-
ini_set("sendmail_from","fromme@earthlink.net");
-
-
# I made some changes here - Ajaxrand
-
# Replaced $_HTTP_POST_VARS with $_POST
-
# and One more thing does your HTML form using POST method or GET method, Make sure to use POST.
-
-
$name = $_POST['Name'];
-
$email = $_POST['Email'];
-
$message = $_POST['Message'];
-
$phone = $_POST['Phone'];
-
-
$message = stripslashes($message);
-
-
$sendTo = "me@earthlink.net";
-
$subject = "Message from Web Site";
-
-
$msg_body = "Name: $name\n";
-
$msg_body .= "E-Mail: $email\n";
-
$msg_body .= "Comments: $message\n";
-
$msg_body .= "Phone: $phone\n";
-
-
$header_info = "From: ".$name." <".$email.">";
-
-
mail($sendTo, $subject, $msg_body, $header_info);
-
-
?>
If you failed to execute this script with the expecting result.Send me the output of this script. function_exists.php -
<?php
-
if (function_exists('mail')) {
-
echo "mail() function available.<br />\n";
-
} else {
-
echo "mail() function not available.<br />\n";
-
}
-
-
?>
-
Are you getting any error messages back from this script? Have you enabled error reporting as the top post in this forum describes?
no error messages at all...nothing at all happens.
Why don't you post your html Form or host it some where and send us the link.
Sometimes problem might be there at the HTML side.
Motoma is expecting something like this, give it a try.
As i remember u failed to edit your php.ini, but this ini_set ( string $varname, string $newvalue ) is an alternative for that. -
<?php
-
error_reporting(E_ALL);
-
ini_set('display_errors', True);
-
ini_set("smtp","smtpauth.earthlink.net");
-
ini_set("smtp_port","25");
-
ini_set("sendmail_from","fromme@earthlink.net");
-
-
# I made some changes here - Ajaxrand
-
# Replaced $_HTTP_POST_VARS with $_POST
-
# and One more thing does your HTML form using POST method or GET method, Make sure to use POST.
-
-
$name = $_POST['Name'];
-
$email = $_POST['Email'];
-
$message = $_POST['Message'];
-
$phone = $_POST['Phone'];
-
-
$message = stripslashes($message);
-
-
$sendTo = "me@earthlink.net";
-
$subject = "Message from Web Site";
-
-
$msg_body = "Name: $name\n";
-
$msg_body .= "E-Mail: $email\n";
-
$msg_body .= "Comments: $message\n";
-
$msg_body .= "Phone: $phone\n";
-
-
$header_info = "From: ".$name." <".$email.">";
-
-
mail($sendTo, $subject, $msg_body, $header_info);
-
-
?>
If you failed to execute this script with the expecting result.Send me the output of this script. function_exists.php -
<?php
-
if (function_exists('mail')) {
-
echo "mail() function available.<br />\n";
-
} else {
-
echo "mail() function not available.<br />\n";
-
}
-
-
?>
-
when I run function_exists.php this is what comes up.....
mail() function available.
when I run contact.php (by hand-typing it into my browser) using the above coding you gave me inserted into the contact.php file and I even tried it with the original coding I was given from the template designer, it runs and the form is sent to my email...I just get it without any name, email, comments, etc. inserted. So this tells me the coding for the form is fine, but the connection with the submit button to access the contact.php file is not working. When I click the submit button nothing happens (no error, nothing). There is no connection to the contact.php file. I am understanding the problem better but I don't know how to fix it :(
when I run function_exists.php this is what comes up.....
mail() function available.
when I run contact.php (by hand-typing it into my browser) using the above coding you gave me inserted into the contact.php file and I even tried it with the original coding I was given from the template designer, it runs and the form is sent to my email...I just get it without any name, email, comments, etc. inserted. So this tells me the coding for the form is fine, but the connection with the submit button to access the contact.php file is not working. When I click the submit button nothing happens (no error, nothing). There is no connection to the contact.php file. I am understanding the problem better but I don't know how to fix it :(
Show me the coding for Submit button, better to post entire html FORM.
Now it has verified the problem is with your HTML form.
mail function - OK
SMTP server - OK
Show me the coding for Submit button, better to post entire html FORM.
Now it has verified the problem is with your HTML form.
mail function - OK
SMTP server - OK
I know this is going to sound odd, but I don't have the coding for the submit button. there are only 2 files that i have access to that have coding....the contact.php and the siteinfo.txt. The other files are .swf files or image galleries/slideshows. The two html files are for the intro page and then the main site. I don't know how or if I can access the html coding files.
seems like you're using flash then :)
what version of flashplayer do you have? and what version is the script written to work with?
sounds like it could be a bug in the OS compability (don't know anything about flash on MacOS)
I know this is going to sound odd, but I don't have the coding for the submit button. there are only 2 files that i have access to that have coding....the contact.php and the siteinfo.txt. The other files are .swf files or image galleries/slideshows. The two html files are for the intro page and then the main site. I don't know how or if I can access the html coding files.
You made us to run on different routines with out saying that you are using FLASH script/form for the user input section.No matter, after posting this much posts now i have to say, please contact your Flash developer and ask her to do like this. - Create a flash form which uses POST method and the action for that form should be the path of your php script.
- As Ronnil suggest it should be compatible with your MacOS/Browser
You made us to run on different routines with out saying that you are using FLASH script/form for the user input section.No matter, after posting this much posts now i have to say, please contact your Flash developer and ask her to do like this. - Create a flash form which uses POST method and the action for that form should be the path of your php script.
- As Ronnil suggest it should be compatible with your MacOS/Browser
Many thanks to all for all of the advice. I apologize for my limited knowledge with all of this...I did not intend to frustrate anyone or intentionally leave out any information.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Pete Mahoney |
last post by:
Ok I use a textarea to store data input by the user, and then upon
them clicking the submit button I store this data to a database. The
problem is once the user inputs too much data (about 3...
|
by: Luis |
last post by:
Application X has three screens. The user captures information on
screen one and then clicks a navigation button to go onto screen two.
He does the same on screen three. At the bottom of screen...
|
by: Ian Davies |
last post by:
Hello
I am trying to run a few INSERT queries only if the user clicks 'continue'
in a <a href> The queries takes variables created from SELECT queries. I
have tried to acheive this by putting The...
|
by: John |
last post by:
Hi all,
This really is quite an urgent matter.
I have a page with multiple, dynamically-loaded user controls and when a
user clicks on a button, the whole form is submitted. Now at this stage...
|
by: johnjjj |
last post by:
I have a form with some asp.net fields and some validation controls. Then I
added an asp:button. I run the app and when I hit the submit button,
nothing happens. The page_load is not called and...
|
by: Galina |
last post by:
Hello
I have 6 dependent list boxes on my ASP page:
Faculty;
Lecturer;
Course;
Course occurrence;
Group;
Week commencing date.
When faculty is selected, lists of lecturers and...
|
by: Glenn |
last post by:
Hi!
I've developed an app that displays multiple textbox and
combobox fields (most of which are autopostback) on a form
along with a submit button. My users find it confusing
when they change...
|
by: anthonybrough |
last post by:
I have an asp page that has a form to collect user data in a form.
when the user clicks submit the input is validated. If any fields are
not acceptable the user clicks on a button to go back to...
|
by: agarwalsrushti |
last post by:
Hi,
Ive created a registration page in which at the last it asks the user to upload the resume file. When the user clicks on the upload button to upload the file it automativcally submits all the...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
| |