Link to home
Start Free TrialLog in
Avatar of HelpNearMe
HelpNearMeFlag for Afghanistan

asked on

form submit button

I am using a basic html form on a webpage.  The form is data is sent to a CRM as a lead.  I don't want to pay the extra fee to have email alerts when a lead arrives, instead I'd like to add a script that will send an email to me when someone presses the submit button.  By the way it's in a WP page.

Any idea how I can do this?  Form is attached.
<form action="https://crm.zoho.com/crm/WebToLeadForm" method="post">
									
									<input name="xnQsjsdp" type="hidden" value="Lq0jaqtw4N4$" />
									
									<input name="xmIwtLD" type="hidden" value="Bi-mWp6ASSkfxf1fznbnRW-*B6-MHnNR" />
									
									<input name="actionType" type="hidden" value="TGVhZHM=" />
									
									<input name="returnURL" type="hidden" value="http://www.helloworld.com/thank-you/" />
									
									<div class="inputRow">
										
										<label for="firstNameTop">First Name:</label>

										<input maxlength="40" name="First Name" type="text" id="firstNameTop" />
										
									</div><!-- inputRow -->
									
									<div class="inputRow">
										
										<label for="lastNameTop">Last Name:</label>

										<input maxlength="80" name="Last Name" type="text" id="lastNameTop" />
										
									</div><!-- inputRow -->
									
									<div class="inputRow">
										
										<label for="emailTop">Email:</label>

										<input maxlength="100" name="Email" type="text" id="emailTop" />
										
									</div><!-- inputRow -->
									
									<div class="inputRow">
										
										<label for="phoneTop">Phone:</label>

										<input maxlength="30" name="Phone" type="text" id="phoneTop"/>
										
									</div><!-- inputRow -->
									
									<input name="save" type="submit" value="" class="contentTopBannerSubmitButton" />
																		
								</form><!--#form -->

Open in new window

Avatar of gavsmith
gavsmith
Flag of United Kingdom of Great Britain and Northern Ireland image

You can not send email using javascript, I saw your other post... there is a WP plugin called wp_mail_smtp (http://wordpress.org/extend/plugins/wp-mail-smtp/) which as the name suggests allows you to send email through a SMTP server of your choice. however if you don't have your own SMTP server you could end up having to pay for that so probably wouldn't save you anything.
In theory, you could invoke an ajax or javascript on-demand call to a server-side script with a query string that would send you an email. To do this in ajax, the script would have to reside in the same domain as the form page. But javascript on-demand is not so limited.
Avatar of liranp1
try this link,

http://www.asp.net/general/videos/how-do-i-create-a-contact-us-page

i added this settings:

 <mailSettings>

      <smtp from="your mail address">

        <network

             host="smtp of ISP"
 
             userName="user"
 
             port="25"

             password="password"  />

      </smtp>

    </mailSettings >
use your gmail account authentication while sending your email if you dont have SMTP account.

for Wordpress using WP plugin :

http://sudarmuthu.com/blog/how-to-send-email-in-wordpress-using-gmails-smtp-server

For simple web form for your individual application :

http://yasserzaid.wordpress.com/2009/04/12/send-email-using-gmail-account/

Hope this helps



Avatar of HelpNearMe

ASKER

xmediaman:

Thanks for the info, I'm no javascript expert but could on use the onsubmit event to open a new .php page that would do the notifcation email then I could forward to the thank you page.  If this concept is correct can you give me an idea of how the onsubmit syntax would look?  I can deal with the php bit on my own, it's just the javascript part that I need help with.

Thanks,

HNM
ASKER CERTIFIED SOLUTION
Avatar of Kim Walker
Kim Walker
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
xmediaman:

The header script didn't seem to work so well, instead I added a test to the page body and it worked fine!  

<?php if(is_page('thank-you')) {

      if ( (strpos(strtolower($_SERVER['HTTP_USER_AGENT']),'bot') == false) && 
                  (strpos(strtolower($_SERVER['HTTP_USER_AGENT']),'slurp') == false ) ) {
            $message = "A contact/lead has just submitted the form.\n\n";
            $recipients = 'me@helloworld.com';
            mail($recipients,'Lead Alert!',$message,'FROM: info@helloworld.com);
      }

}  ?>


Thanks!

HNM
Glad you could make it work. You're welcome.