# PHP Formmail



## hedge15 (Oct 26, 2014)

I am having issues with formmail on my web site. It doesn't send emails to me. I checked with Godaddy and they are not being sent from the code so its a coding issue but I cannot figure it out. I replaced my URL with TESTPRO in the below code but I don't see where the error is and I have been at this for 3 days. Any help would be greatly appreciated. 



```
<html>
<head>
<title>TESTPRO</title>
<meta name="keywords" content="emini, e-mini, emini system, futures trading system, e-mini system, CTA, commodity trading advisor, auto-trading, auto trading, auto trade, auto-trade, mentor, mentoring, daytrading, daytrading futures, daytrading emini, daytrading e-mini, black box, gray box, discount online futures broker, commodities futures day traders,  commodities futures trading, online futures broker, online futures trading, commodities trading firm,  e mini trading, remote futures trading, black box trading, futures trader, futures trading, management, cta, cta program, DKASS, strategic asset management, auto trading, auto-trading, futures chat room, futures signals, emini chat room, emini signals, emini auto trading, emini auto-trading,  e-mini chat room, e-mini signals, e-mini auto trading, e-mini auto-trading, es chat room, es signals, es auto trading, es auto-trading, proprietary trading, trading, broker, brokers, trader training, trader classes, trader trainees, prop trader, prop trading, series 7, series 55, series 63, trading firm, futures, traders, trading floor, Rotblut, Jef Rotblut, financial management, trading careers, trader jobs, trading jobs, equity jobs, equity careers, wall street career, wall street careers, wall street, best trader, best trading, best traders, best training program,  onlinetrading, online trader, remote trader, remote trading, trading commissions, trading fees, commission rates, finance, finance job, finance jobs, finance position, prop shop, profitable trader, profitable trading, profitable traders, consistent profits, consistent profitability, risk management, managing risk, day trading online, discount online trading, e mini trading, remote futures trading, black box trading, Auto-Trading, Commodity Trading, automated forex trading, Currency Day Trading, Day Trading, forex system, discount online futures broker, commodities futures day traders,  commodities futures trading, online futures broker, online futures trading, commodities trading firm, commodities trading software">
<meta name="description" content="emini, e-mini, emini system, futures trading system, e-mini system, CTA, commodity trading advisor, auto-trading, auto trading, auto trade, auto-trade, mentor, mentoring, daytrading, daytrading futures, daytrading emini, daytrading e-mini, black box, gray box, discount online futures broker, commodities futures day traders,  commodities futures trading, online futures broker, online futures trading, commodities trading firm,  e mini trading, remote futures trading, black box trading, futures trader, futures trading, management, cta, cta program, DKASS, strategic asset management, auto trading, auto-trading, futures chat room, futures signals, emini chat room, emini signals, emini auto trading, emini auto-trading,  e-mini chat room, e-mini signals, e-mini auto trading, e-mini auto-trading, es chat room, es signals, es auto trading, es auto-trading, proprietary trading, trading, broker, brokers, trader training, trader classes, trader trainees, prop trader, prop trading, series 7, series 55, series 63, trading firm, futures, traders, trading floor, Rotblut, Jef Rotblut, financial management, trading careers, trader jobs, trading jobs, equity jobs, equity careers, wall street career, wall street careers, wall street, best trader, best trading, best traders, best training program,  onlinetrading, online trader, remote trader, remote trading, trading commissions, trading fees, commission rates, finance, finance job, finance jobs, finance position, prop shop, profitable trader, profitable trading, profitable traders, consistent profits, consistent profitability, risk management, managing risk, day trading online, discount online trading, e mini trading, remote futures trading, black box trading, Auto-Trading, Commodity Trading, automated forex trading, Currency Day Trading, Day Trading, forex system, discount online futures broker, commodities futures day traders,  commodities futures trading, online futures broker, online futures trading, commodities trading firm, commodities trading software">
<META NAME="Language" CONTENT="english">
<META NAME="Robots" CONTENT="All">
<META NAME="revisit-after" CONTENT="7 days">
<LINK href="main.css" rel=stylesheet type=text/css>
<script language="JavaScript1.2" src="menu.js"></script>
<script language="JavaScript1.2" src="mm_menu.js"></script>
<script language=javascript>

function validate()
{
	if(document.form1.realname.value=="")
	{
		alert("Key in your name");
		document.form1.realname.focus();
		return;
	}

	if((document.form1.email.value=="") || 
	(document.form1.email.value.indexOf('@',0)=="-1") || 
	(document.form1.email.value.indexOf('.',0)=="-1"))
	{
		alert("Key in your Email");
		document.form1.email.focus();
		return;
	}

	if(document.form1.address.value=="")
	{
		alert("Key in your Address");
		document.form1.address.focus();
		return;
	}

	if(document.form1.TelNo.value=="")
	{
		alert("Key in your Telephone Number");
		document.form1.TelNo.focus();
		return;
	}


	if(document.form1.AdditionalInformation.value=="")
	{
		alert("Key in your Additional Information");
		document.form1.AdditionalInformation.focus();
		return;
	}
	

	else
	
	{
		document.form1.submit();
		alert("Thank You");
	}
}


</script>
</head>

<body bgcolor="#333333" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<script language="JavaScript1.2">mmLoadMenus();</script>
<table width="780" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#FFFFFF">
  <tr>
    <td><a href="index.html"><img src="images/logo.gif" width="249" height="90" border="0" alt="TESTPRO"></a></td>
    <td align="right" valign="top"><img src="images/toplinks1.jpg" width="132" height="12" vspace="10" hspace="10" usemap="#Map" border="0"><map name="Map"><area shape="rect" coords="-4,-4,33,13" href="index.html"><area shape="rect" coords="54,-3,139,24" href="contactus.html"></map></td>
  </tr>
</table>
<table width="780" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td><a href="index.html"><img src="images/home_1.gif" width="77" height="26" border="0"></a></td>
    <td><a href="aboutus.html" onMouseOut="MM_startTimeout()" onMouseOver="MM_showMenu(window.mm_menu_0,0,27,null,'nav_aboutus');"><img src="images/aboutus_1.gif" width="96" height="26" border="0" name="nav_aboutus"></a></td>
    <td><a href="managed.html" onMouseOut="MM_startTimeout()" onMouseOver="MM_showMenu(window.mm_menu_1,0,27,null,'nav_man');"><img src="images/managedfutures_1.gif" width="139" height="26" border="0" name="nav_man"></a></td>
    <td><a href="solutions.html" onMouseOut="MM_startTimeout()" onMouseOver="MM_showMenu(window.mm_menu_2,0,27,null,'nav_solutions');"><img src="images/solutions_1.gif" width="94" height="26" border="0" name="nav_solutions"></a></td>
    <td><a href="faq.html" onMouseOut="MM_startTimeout()" onMouseOver="MM_showMenu(window.mm_menu_3,0,27,null,'nav_faq');"><img src="images/faq_1.gif" width="67" height="26" border="0" name="nav_faq"></a></td>
    <td><a href="contactus.html"><img src="images/contactus_1.gif" width="105" height="26" border="0"></a></td>
    <td background="images/bg.gif" width="300"> </td>
  </tr>
</table>
<table width="780" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr> 
    <td><img src="images/in_img6.jpg" width="311" height="142"></td>
    <td><img src="images/in_right1.jpg" width="469" height="142"></td>
  </tr>
</table>
<table width="780" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="696E71">
  <tr align="left"> 
    <td valign="top" height="10"><img src="images/dot.gif" width="1" height="1"></td>
  </tr>
  <tr align="left"> 
    <td valign="top"><img src="images/contactus_t.gif" width="301" height="30"> 
    </td>
  </tr>
  <tr align="left"> 
    <td valign="top"> 
      <table width="760" border="0" cellspacing="0" cellpadding="0" align="center">
        <tr> 
          <td><img src="images/top.gif" width="760" height="9"></td>
        </tr>
        <tr bgcolor="C0B8AD"> 
          <td> 
            <table width="100%" border="0" cellspacing="0" cellpadding="15">
              <tr> 
                <td class="text"> 
                  <p> <b class="texthead">TESTPRO </b><br>
                    67 Prospect Avenue <br>
                    Suite 7C <br>
                    Hewlett, NY 11557 <br>
                    <br>
                    Tel:  (800) 375-5611<br>
                    Fax: (509) 694-6013 <br>
                  </p>
                  <table width="200" border="0" cellspacing="0" cellpadding="0">
                    <tr class="text"> 
                      <td>Web:</td>
                      <td><a href="http://www.TESTPRO.com">http://www.TESTPRO.com 
                        </a></td>
                    </tr>
                    <tr class="text">
                      <td>Email:[email protected]</td>
                      <td> <a href="mailto:[email protected]">[email protected]</a> 
                      </td>
                    </tr>
                  </table>
                  <br>
                  <table width="600" border="0" cellspacing="0" cellpadding="0" align="center">
                    <tr bgcolor="FFFBE6"> 
                      <td> 
                        <table cellspacing="0" cellpadding="3" border="0" align="center" width="600">
                          <form action="thankyou.html" method = "POST" name="form1">
                            <tr> 
                              <td align="CENTER" colspan="2" class="text">Please 
                                fill out all the required fields. (<font color="#FF0000">*</font>) 
                              </td>
                            </tr>
                            <tr> 
                              <td align="right" class="text" width="163"> Name 
                                <font color="#FF0000">*</font></td>
                              <td class="text" width="425"> 
                                <input name="realname" type="TEXT" size="20" class="tinput">
                              </td>
                            </tr>
                            <tr> 
                              <td align="right" class="text" width="163"> Email 
                                <font color="#FF0000">*</font></td>
                              <td class="text" width="425"> 
                                <input type="text" size="20" name="email" class="tinput" />
                              </td>
                            </tr>
                            <tr> 
                              <td align="right" width="163" class="text"> Address: 
                                <font color="#FF0000">*</font></td>
                              <td width="425" class="text"> 
                                <textarea name="address" cols="20" rows="3" wrap="VIRTUAL"></textarea>
                              </td>
                            </tr>
                            <tr> 
                              <td align="right" width="163" class="text">City: 
                              </td>
                              <td width="425" valign="top" class="text"> 
                                <input name="City" type="TEXT" size="20" class="tinput">
                              </td>
                            </tr>
                            <tr> 
                              <td align="right" width="163" class="text">State 
                                / Zip: </td>
                              <td width="425" valign="top" class="text"> 
                                <select name="State" class="tinput" id="select2">
                                  <option selected>AL</option>
                                  <option>AK</option>
                                  <option>AZ</option>
                                  <option>AR</option>
                                  <option>CA</option>
                                  <option>CO</option>
                                  <option>CT</option>
                                  <option>DE</option>
                                  <option>DC</option>
                                  <option>FL</option>
                                  <option>GA</option>
                                  <option>HI</option>
                                  <option>IA</option>
                                  <option>ID</option>
                                  <option>IL</option>
                                  <option>IN</option>
                                  <option>KS</option>
                                  <option>KY</option>
                                  <option>LA</option>
                                  <option>ME</option>
                                  <option>MD</option>
                                  <option>MA</option>
                                  <option>MI</option>
                                  <option>MN</option>
                                  <option>MS</option>
                                  <option>MO</option>
                                  <option>MT</option>
                                  <option>NE</option>
                                  <option>NV</option>
                                  <option>NH</option>
                                  <option>NJ</option>
                                  <option>NM</option>
                                  <option>NY</option>
                                  <option>NC</option>
                                  <option>ND</option>
                                  <option>OH</option>
                                  <option>OR</option>
                                  <option>PA</option>
                                  <option>RI</option>
                                  <option>SC</option>
                                  <option>SD</option>
                                  <option>TN</option>
                                  <option>TX</option>
                                  <option>UT</option>
                                  <option>VT</option>
                                  <option>VA</option>
                                  <option>WA</option>
                                  <option>WI</option>
                                  <option>WV</option>
                                  <option>WY</option>
                                </select>
                                <input name="Zip" type="text" id="Zip" size="10" class="tinput">
                              </td>
                            </tr>
                            <tr> 
                              <td align="right" class="text" width="163">Country 
                              </td>
                              <td class="text" width="425"> 
                                <input name="City2" type="TEXT" size="20" class="tinput">
                              </td>
                            </tr>
                            <tr> 
                              <td align="right" class="text" width="163">Telephone 
                                <font color="#FF0000">*</font></td>
                              <td class="text" width="425"> 
                                <input name="TelNo" type="TEXT" size="20" class="tinput">
                              </td>
                            </tr>
                            <tr class="text">
                              <td align="right" width="163" valign="top">Subject 
                              </td>
                              <td width="425" valign="top">
                                <select name="select">
                                  <option value="General Inquiry" selected>General 
                                  Inquiry</option>
                                  <option value="TimeWarp Trading Program">TimeWarp 
                                  Trading Program</option>
                                  <option value="Strategic Asset Management Program">Strategic 
                                  Asset Management Program</option>
                                  <option value="Auto-Trading">Auto-Trading</option>
                                  <option value="Mentoring Solutions">Mentoring 
                                  Solutions</option>
                                  <option value="Managed Accounts">Managed Accounts</option>
                                </select>
                              </td>
                            </tr>
                            <tr class="text"> 
                              <td align="right" width="163" valign="top"> Your 
                                Message <font color="#FF0000">*</font></td>
                              <td width="425" valign="top"> 
                                <textarea name="AdditionalInformation" rows="8" cols="60" wrap="VIRTUAL" class="tinput"></textarea>
                              </td>
                            </tr>
                            <tr> 
                              <td align="center" colspan="2" class="text"> <font size="2" face="Arial">
                                <input type="hidden" name="TESTPRO" value="[email protected]">
                                </font>
                                <input type="hidden" name="subject" value="Enquiry from TESTPRO.com">
                                <input type=hidden name="redirect" value="thankyou.html">
                                <input  type="button" value="Submit" onClick="validate()" name="button">
                                   
                                <input name="reset" type="RESET" value="Clear all">
                              </td>
                            </tr>
                          </form>
                        </table>
                      </td>
                    </tr>
                  </table>
                  
                </td>
              </tr>
            </table>
          </td>
        </tr>
        <tr> 
          <td><img src="images/bottom.gif" width="760" height="9"></td>
        </tr>
      </table>
    </td>
  </tr>
  <tr align="left">
    <td valign="top" height="10"><img src="images/dot.gif" width="1" height="1"></td>
  </tr>
</table>
<table width="780" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr bgcolor="696E71"> 
    <td>
      <table width="100%" border="0" cellspacing="1" cellpadding="5">
        <tr> 
          <td bgcolor="63A4E6" class="whitetext" valign="top" width="175">TESTPRO<br>
            67 Prospect Avenue<br>
            Suite 7C<br>
            Hewlett, NY 11557</td>
          <td bgcolor="63A4E6" class="whitetext" valign="top" width="200"> 
            <table width="100%" border="0" cellspacing="0" cellpadding="1">
              <tr class="whitetext"> 
                <td>Phone:</td>
                <td>800-375-5611</td>
              </tr>
              <tr class="whitetext"> 
                <td>Fax:</td>
                <td>509-694-6013</td>
              </tr>
            </table>
          </td>
          <td bgcolor="C0B8AD" align="center" class="footerlinks">Copyright © 
            2014. <BR>TESTPRO. <BR>All rights reserved.</td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table width="780" border="0" cellspacing="0" cellpadding="8" align="center">
  <tr> 
    <td class="whitetext" bgcolor="696E71"><a href="legal.html" class="whitetext">Legal Statement</a> 
       |  <a href="privacy.html" class="whitetext">Privacy Policy</a>  |  <a href="disclaimer.html" class="whitetext">Disclaimer</a></td>
  </tr>
  <tr valign="middle" align="center"> 
    <td class="whitetext"></td>
  </tr>
</table>
<br>
</body>
</html>
```


----------



## HonorGamer (Oct 11, 2014)

Well the problem is, there is no PHP sending the email, and getting the information from the form to provide in the email.

Here's a tutorial i found just by google searching, Email Form - Simple Form to Email PHP Contact Form

-Justin


----------



## hedge15 (Oct 26, 2014)

Thanks for the reply Justin. As I have moderate programming skills (I am just learning this stuff on the fly), is there one command line I need to add to to tell the script where to send and what? Is that what the PHP would do and if so, I would greatly appreciate it if you could post that line and let me know where I should add it. Thanks a ton.


----------



## HonorGamer (Oct 11, 2014)

When I first started coding someone made me an example and i learned from there. 

So what I did is i made an example, now mind you, it's not a secure way, but google is always your friend.

If you find an error, let me know and I shall fix.

View attachment Contact.zip


----------



## hedge15 (Oct 26, 2014)

Justin, 

I do appreciate the time and help. It will take me some time to figure out what I need to plug into my existing web page which is more than just a formmail so I guess this will have to wait until next week. I have a meeting with a prospective client and they wanted to see a completed web site. The fact that the formmail doesnt work, will not be an issue as they will never know that I never received it or not.

I was hoping it was just a line of code or a command that was missing from my exisiting code. In order to plug your code it, I would need to not only plug your code in, but change the size and color to match the existing web sites feel and look and I just do not have time for that right now. 

After the meeting, I will have some less stressed time when I can sit down and play with the code and hopefully take your example and get it working. Once again, thanks for your time.


----------



## DDAoN (Mar 19, 2011)

@hedge15: Welcome to TSF! I'm sorry to hear you can't get your form to send e-mail, and as HonorGamer pointed out, you need a server-side language to perform such actions. Having said that, PHP, ASP, and JSP (three of the more common server-side languages) are not languages to just jump into using if you haven't learned them.

What I recommend you do is to hop onto CodeCademy. I've not done the PHP course there, but going through the rest as a refresher gave me the impression is was a good place to learn.

Also, check out W3Schools. When it comes to Internet-based languages, they are a great source for beginners and experts.

As for what you need for your code, there is no one-command solution. There's simply too much needing to be done and no command that could handle it all in any language.

Everything you need to do won't go into the file you've provided, but in the page the form submits to. In this case, "thankyou.html" is the target. However, you'll have to change this to a file type that supports the server-side language you use. If you choose PHP, which HonorGamer has provided you a solution for, and I recommend, it'd be "thankyou.php". Basically, you just have to update the file extension so your server will recognize the type of languages it will contain.

Beyond that, I'm afraid there's no instant solution we can provide that will also help you understand it. It does sound like you have the right idea on where to go from here. I hope these resources will help you reinforce what you know and help you find answers to questions you have yet to formulate.


----------



## hedge15 (Oct 26, 2014)

Thanks DDAoN. Its really a matter of time. Our most valuable commodity and right now I just don't have the time right now. I was hoping it was something that got lost while I was working on it as the page worked previously. I will have more time next week unless something else comes up, and I will check out the sites you posted.


----------



## Fjandr (Sep 26, 2012)

"thankyou.html" isn't actually the target, it's simply a redirect after the form submits. The key is the "validate()" function, which is where the form output is sent.

The "validate()" function completes successfully when the last "else" is triggered, which passes the form data to the function "document.form1.submit();" I didn't look thoroughly to see if there's an included .js file which might have this function embedded, but if not one needs to be written. It would include code to pass the form data to something like sendmail (which would be the actual mail agent program on the server).

That said, there are much easier ways of doing this. One is the actual PHP Formmail code (there are a number of scripts which have adopted the name, but I believe this is the original) here: PHP FormMail – Freecode


----------



## DDAoN (Mar 19, 2011)

@Fjandr: Yes, it can be configured that way, but it isn't. The "submit()" function is a valid native function of JavaScript (Document Object Model HTML). It submits a designated form. As the code stands, the JavaScript has no purpose other than to validate the form. Once complete, the form processes normally by submitting the content to the "action" via the "method". In this case, once the JavaScript and run without alerting, the form is submit to "thankyou.html" via the "POST" method.

I do agree with using a pre-existing set-up if you don't have the time to learn how-to make one yourself (which is what HonorGamer linked to).


----------



## Fjandr (Sep 26, 2012)

Ah. I rarely use JS, so I'm not up on most of the native functions. Seems an odd way to go about that process, but that's just me. :smile:

(I also must not have actually read the form tag as that would have made my mistake obvious, but then I was falling asleep at my desk when I wrote my previous post.)


----------



## DDAoN (Mar 19, 2011)

lol, No worries. I believe that if we aren't learning, then we're doing life wrong. 

As for it being odd, it is. The script should be configured to stop the process of submission only if validation fails. That way, if the validation succeeds, it simply continues the default process of submitting the form. A problem with normal implementation with this code is that the script is lacking the proper reaction to failed validation when it is being called. Take a look here for a bit more information on what I mean.

Honestly, I'd use jQuery and avoid using "onClick" or "onLoad" in any of my tags. It's invasive to have styling, scripting, and content mixed together. Web developers use to do this that way to simply get it done. Now, websites are far too complex to do so. Mixing the codes together would result in duplicate code everywhere that something needs to be called, and results in significantly more work to update what could otherwise be a one-line edit.


----------

