function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
TheBootTheBoot 

Dual Webtolead form submission

I am a total php greenhorn - so please bear with me.  I am working on implementing WebtoLead for my company.  Our website currently has a basic 'Register as a new user' form that registers the user to give them permission to download various technical data sheets, and i would like to replace that form with the WebtoLead form.  I am hindered because I need that form to register my users and create new leads at the same time.  It seems like this should not be that hard - and a fairly common task that people using Salesforce would need to accomplish.  I have been searching the discussion boards, and not come up with a lot of help.  What I have come accross is the mention of needing to run some php script to send the information to two souces after the user presses submit.
 
As i mentioned in the beginning of this post - I am a php greenhorn.  I am the SFDC admin for my org, but we outsource our web hosting and design.  We do have Dremweaver 8, so we can access and make changes to our site.  But I am not super familiar with how this works either.  I have been talking to our web consultants about them creating this php script  to use witht he Salesforce webtolead form, but frankly I am not all that confident in their abilities to implement it.  Plus I would really love to learn how to do it myself.
 
So, hopefully all of you smart php people will not find me too annoying, and out of place and take pity on me and send some help my way.  I would really appreciate it!!  this may not even be the best way to accomplish this task, so if anyone knows of a better, hopefully easier way I would love to hear it!
 
Thanks!
 
-Brandy:smileyhappy:
Park Walker (TAGL)Park Walker (TAGL)
The web-to-lead form is not designed to be post-processed by your web site. The form action sends the information directly to Salesforce.com along with a 'return url' that the user is directed to once the request has been processed. While you are right that your requirement is fairly typical, it is most often solved using the Salesforce API and some programming.

You imply that your registrations are already being processed on the web server to register your users. Does this mean that there is some code somewhere that takes care of this? If so, the easiest course of action would probably be to modify that piece of code so that it also adds the lead to salesforce.com, using the API, at the same time that our registration database is updated. This is not a difficult task for someone familiar with PHP and the examples in the toolkit are very helpful. If you do not feel that your current web consultants can handle the task I'm sure you could find someone here who would be willing to help out, but it will require you providing the existing registration code.

Park
TheBootTheBoot

Park,

Thanks for taking the time to respond. 


Redsummit wrote:

You imply that your registrations are already being processed on the web server to register your users. Does this mean that there is some code somewhere that takes care of this?


I am not quite sure how this is being handled.  How can I find out?


 


Redsummit wrote:
the easiest course of action would probably be to modify that piece of code so that it also adds the lead to salesforce.com, using the API, at the same time that our registration database is updated.


This sounds like  it's doable.  I'm not too familiar with the API, but I just found the Wiki yesterday, and am getting educated. 

Can I bug  you later when I find out more?

:smileyhappy:




 

Park Walker (TAGL)Park Walker (TAGL)
Take a look at the source for your current registration form. Find the start of the form definition (look for the <form> tag). One of the attributes on the form tag will be 'action'. That tells you the program the form is currently being sent to when the user submits it. You need to find that  file in your site directory.  If it's a PHP file  you should be able to modify it to do what you want. If it's written in some other language you can still probably modify it, but you'll need to do it in the language it's written in or replace it entirely with PHP code.

The wiki is a good place to start. You'll need a place that you can install the toolkit and play around a bit. Please feel free to post here for additional help.

Park
TheBootTheBoot

Thanks for the direction -  I love learning new stuff.  thanks also for your patience and kindness in helping me!

-B

TheBootTheBoot

ok, I think I found the tag you were speaking of - see below:

 

                                    <?php

                                                if ($_REQUEST['errortxt'] != null && $_REQUEST['errortxt'] != "")

                                                {

                                                            echo '<span class="contentnormal"><b>' . $_REQUEST['errortxt'] . '</b></span>';

                                                }

                                                ?>

                          </p>                               </td>

            </tr>

            <tr>

              <td><form action="/lib/form_account_suc.php" method="post" name="account" id="account">

 

Looks like it is php, right?  this is frm the HTML file for that page...so now  - if I understand you correctly - I need to go find the corresponding php file?  Correct?

-B

Park Walker (TAGL)Park Walker (TAGL)
Right, this line is the beginning of the form:

<form action="/lib/form_account_suc.php" method="post" name="account" id="account">

So you need to look in [web root directory]/lib for the file form_account_suc.php. If you've got Dreamweaver this should be pretty easy to find.
Bmin7Bmin7

Hi Park,

Well here i am again, this time with a different name.  I signed up for a developer account.  Its kind of a bummer that I can't be logged into Salesforce as 2 different people simultaneously, but that is not really the point.

Anyway, I found the .php file you said to find, and it looks a lot like HTMS, but it does have some arrays and functions, and it is actually .php. So anyway... I am a little stalled on what to do next.  I tried to download the toolkit you mentioned - was that the Ajax toolkit, or php toolkit?  I downloaded the php one, and the latest version of php from php.com, but I cant seem to open the file I downloaded from the php toolkit page. 

So... what should I try next?

-Brandy

Park Walker (TAGL)Park Walker (TAGL)
The PHP Toolkit is the correct item; the file should be php5-1.0.6.zip. It's just a standard ZIP file and should expand to a collection of folders and files that provide the API library, documentation and some sample code. If you can't open the archive you may want to try downloading it again. You'll need to follow the setup instructions in instructions.html to get things set up correctly. The first step would be to get the samples/HelloWorld.php script running.

Park
Bmin7Bmin7

Hi Park,

Thanks for the quick response. 


Redsummit wrote:
The PHP Toolkit is the correct item; the file should be php5-1.0.6.zip.

I can't seem to find this.  I searched apex, the Wiki, Sourceforge.net, and Google...

Can you direct me?

Thanks!

-Brandy

Park Walker (TAGL)Park Walker (TAGL)
From the main page of the Wiki, under the API heading, select PHP:

https://wiki.apexdevnet.com/index.php/API#PHP
TheBootTheBoot

Well,

It looks like I better just leave this project to our web consultants.  I just realized that I do not have access to the API because I am a Professional Edition customer.  Oh well.  It's probably for the better. 

So, Park, do you think I could still accomplish the task well by adding some php code to the Web-To-lead HTML instead of inserting my leads through the API?

Thanks!

-Brandy

Park Walker (TAGL)Park Walker (TAGL)
Yes, it's possible to write the information into your local database and then send the information on to Salesforce without using the API. I can think of a couple of ways that it could work. One would be to use AJAX to send the information to the local database and then submit the form data, the other would be to collect the form data in the PHP script, do your local processing and then submit the data to the Web-to-Lead URL as a new request.

Park