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
thierrybthierryb 

Posting form to http://www.salesforce.com/servlet/servlet.WebToLead

Hi,

I am developping a contact form and I have to make a double post (in php), one on my website to save data in the database and another one on salesforce website.

For this task I am using Curl, it nearly works but I am getting problems for multiple select.

Here is my php code :

*****
$information_requested = $_POST["information_requested"];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.salesforce.com/servlet/servlet.WebToLead?encoding=ISO-8859-1" );
curl_setopt($ch, CURLOPT_POST, 1 );

$postContent .= "oid=00D300000000TGF&";
$postContent .= "00N30000000wTNa=$informationsRequested";
   
       
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postContent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$postResult = curl_exec($ch);

curl_close($ch);
*****

Here is my html code :

*****
<input type="checkbox" name="information_requested[]" value="Product1">
<input type="checkbox" name="information_requested[]" value="Product2">
<input type="checkbox" name="information_requested[]" value="Product3">
*****

In my form, informations requested are an array of checkbox.
But salesforces need a <select multiple="multiple"><option value="product1"></option></select>. I don't know if this is the problem, but maybe I don't *construct* the query in the right way.

Do you have an idea ?

Thanks a lot fro your help.

Thierry Bucco

Best Answer chosen by Admin (Salesforce Developers) 
thierrybthierryb
Hi,

Thanks a lot for your answer.
Do you have an exemple of using the Web Service API to add lead into sales force ?

Regards,

thierry

All Answers

Tran ManTran Man
Is there any particular reason to use the HTML form in your scenario?  If not, I would say that the best appraoch is to create a form with PHP from scratch, capture the input, and save the input to Salesforce using the Web services APIs and your database.
thierrybthierryb
Hi,

Thanks a lot for your answer.
Do you have an exemple of using the Web Service API to add lead into sales force ?

Regards,

thierry

This was selected as the best answer
Tran ManTran Man
I would start by downloading the PHP 5 toolkit.  Then check out this thread:  http://forums.sforce.com/sforce/board/message?board.id=PerlDevelopment&message.id=1060&query.id=16133#M1060


thierrybthierryb
Thanks for your answer.

I downloaded the toolkit, but unfortunatly I don't have php 5 installed.
What can I do ?

Thanks

thierry
Tran ManTran Man
The included instructions.html walks you through installing and configuring PHP and Apache.  It also comes with two samples and a number of unit tests that you may find useful.
thierrybthierryb
The problem is I can't upgrade php 4 to 5.
I just want to post checkbox from my form to a Salesforce multi picklist.

thierry
Rare MethodRare Method
I am trying to use curl to post to the WebToLead url.  This is needed because I need to submit the same data to another database.  After curl has executed and I do a var_dump on the result of the execution, this is what I see:


string(196) "HTTP/1.1 100 Continue
Server:
Content-Length: 0
Date: Thu, 16 Nov 2006 23:15:01 GMT

HTTP/1.1 200 OK
Server:
Is-Processed: true
Content-Length: 0
Date: Thu, 16 Nov 2006 23:15:01 GMT

"

I have no way of knowing if any errors occured during the execution and I don't see my submission in the "Leads" area.  Is there anyway to use curl to post to WebToLead?  I will post the code if you guys need to look at it.  Any help will be greatly appreciated.

Thanks,

diegartediegarte

Hi, Thierryb

For complex solutions as yours…I suggest using FormVester for AppExchange.
FormVester can generate leads from any existing online forms into Salesforce.
So in your case, you could use or create your form as normal (using php4 or 5 or whatever other programming language) and make it save data in your website database. Just build it without even thinking about web-to-lead integration. Now FormVester will take care of the web to lead…just past two line of code on your website page where the form is, then it will generate the lead into Salesforce. That way, your php form will generate the lead into your website DB and FormVester will generate the lead into Salesforce. Fast and easy solution!
The application is extremely flexible, so you can map any of your form fields to Salesforce fields…you can even map response of multiple choice questions.

Give it a try – <a href="http://www.salesforce.com/appexchange/detail_overview.jsp?NavCode__c=&amp;amp;id=a0330000002YXhxAAG%22" target="_blank">FormVester for AppExchange</a>

Hope it will help!

Steve415Steve415

Thierry,

Based on the date of your posting you've probably moved on from this problem but I just wanted to post my solution in case someone else out there is Googling with the same issue.

The problem is that when you submit multiple checkbox values via script (Coldfusion, PHP, .NET, etc) that they are usually concatenated into a single value. 

For example, if you have:

<input name="myfield" type="checkbox" value="value1">

<input name="myfield" type="checkbox" value="value2">

<input name="myfield" type="checkbox" value="value3">

 

The Web-To-Lead servlet interpets this as a single value and receives:

myfield=value1,value2,value3 

(You'll see this if you send a hidden field with the name debug and a value of 1)

SFDC doesn't recognize the comma as a delimiter and so you don't get what you expect.  What makes it even more confusing is that the multipicklist values in your SFDC app display delimited by semi-colons!

Instead you need to send over:

myfield=value1

myfield=value2

myfield=value3

This did the trick.  So whenever I encounter a multipicklist I just loop through the comma delimited values and send the values individually.

Hope that helps!

 

dmchengdmcheng
Thanks for posting this Steve - it fixed the problem that we were having with an ASP.NET page.