View Full Version : PHP Form to Mail problem

10-20-2010, 02:56 PM
Hi, I can't send emails from our button for 'Send Enquiry'.

The code is below

<input type="submit" name="Send_enquiry_to_Company" id="Send_enquiry_to_Company" value="Send Enquiry to Company" class="bodytext"/>.

Does anyone know where I put in the email address, I presume there is meant to be an email address in there and how I would go about getting this to work so it submits the form please? Greatly appreciate any help

10-20-2010, 03:44 PM
The e-mail address would go in the PHP you've used to process the form. What does the opening <form> tag say? Does it have an action?

10-20-2010, 03:48 PM
Hi Corrosive, is says the below. Is it meant to say action and email or am I wrong?

<form id="ContactUs" name="ContactUs" method="post" action="FormToEmail.php">

10-20-2010, 04:00 PM
You need to show us the code for the FormtoEmail.php file then. Moved thread to PHP board btw.

10-21-2010, 07:56 AM
I don't have that code, I must have done something seriously wrong here. I just put in the CSS the code for a form. The centre CSS is standard form fields, it starts like:-

<form id="ContactUs" name="ContactUs" method="post" action="FormToEmail.php">
<label for=

Then it ends like this:-

<input type="submit" name="Send_enquiry_to_Company" id="Send_enquiry_to_Company" value="Send Enquiry to Company" class="bodytext"/>
<p class="bodytext"><br />
</form><br />

Perhaps I deleted this php file then, I only have one index.php file in my folder and it just says
<body>Remote file:http://www.blacknight.ie/holding_page.php

I got the code off formtoEmail???

10-21-2010, 08:00 AM
You need that file to process the form. HTML alone will not send an e-mail.

10-21-2010, 08:05 AM
Ugh, it must have been deleted by accident, or never had it!!! Any quick tips on how I go about this, where can you copy html/php. I have the html just not the php?

10-21-2010, 08:08 AM
I think I might have it, I went back on this webpage
and they give free script with php. See how I go, I don't like the bit where they mention configure it to sllow php to sen demails using the mail() funcion.

Ok totally confused. It says step by step and waivers off. Is there an easier way of doing this? Just a submit button like it does in a pdf??? If not, can I ask, it states after I inputted the red code to enter the email $my_email = "info@example.com"; Where do they want me to put it below?

<form action="FormToEmail.php" method="post">
<table border="0" style="background:#ececec" cellspacing="5">
<tr align="left"><td>Name</td><td><input type="text" size="30" name="name"></td></tr>
<tr align="left"><td>Email address</td><td><input type="text" size="30" name="email"></td></tr>
<tr align="left"><td valign="top">Comments</td><td><textarea name="comments" rows="6" cols="30"></textarea></td></tr>
<tr align="left"><td>&nbsp;</td><td><input type="submit" value="Send"><font face="arial" size="1">&nbsp;&nbsp;<a href="http://FormToEmail.com">PHP Form</a> by FormToEmail.com</font></td></tr>

And secondly, it states,
Save this file (loads of jibber jabber code) save it as (FormToEmail.php) and upload it together with your webpage containing the form to your webspace.
So I copied the code into a new .php file and saved it thus. I presume this is correct, but where do you go from here. now I have the html file, and the php file, do I just reload it back up to Ftp and all will work fine or do I have to do something else?

10-21-2010, 08:45 AM
it will probably be in the jibber jabber as it is defining the email address where the mail will be sent to , yours in fact.
add it after the <?php in your mail handler , or at least before the section that says mail($mymail, ....etc

10-21-2010, 08:49 AM
Hi, the only area where I can see where an e-mail would sit is in this section


Should I put it in here to read, ignoring the quotes, won't send without them:-

mail($my_email = "email address in here";,$subject,$message,$headers);

10-21-2010, 08:58 AM
$my_email = "info@example.com";

as above

10-21-2010, 09:02 AM
Thanks very much edbr. I did need it spelt out to me.

Do I have to anything else with this now that it is complete, do I just upload it to the ftp along with the rest of the website? Just that it states it has to be configured.

I already have the email set up with the host company and the company configured it on their end, it is just that the form I did currently obviously wouldn't send as I deleted the php file by accident so hence doing it here again, so now it is done, just upload et voila?

10-21-2010, 09:15 AM
just upload it and test it

10-21-2010, 09:36 AM
I've looked at that FormToEmail.php file and it says exactly where you'll have to put the email address.

$my_email = "delete these words and put the email address only in here between the quotes";


$my_email = "info@company.com";

That's all you have to do. There's no need to place an email address in the form itself.

10-21-2010, 09:39 AM
Oh... Solve already! Didn't see the posts when I clicked on the thread :)