Salesforce custom fields not compatible with PHP variable definition

Salesforce.com created several custom fields for our Web to Lead implementation.  The new fields autogenerated by Salesforce.com begin with numbers, for example 00N80000002tVKX.  Our website uses PHP for the data entry form and another php page to verify the data and post it to Salesforce.  PHP does not allow a variable to begin with a number.  Is there a technique or method that I can  use to define a PHP variable like $cust_field1 and then when the data is posted to Salesforce.com use the custom field 00N80000002tVKX name created by salesforce?
I use Java Script to post the data to Salesforce.com.

Thanks
s_c_alderferAsked:
Who is Participating?
 
Ray PaseurCommented:
Here is what I would do with that situation.  Prefix all the "special" variable names with $sf_ - it will make the SalesForce vars easy to spot in your code.  You can still use the numeric values in the HTML forms, just not inside the PHP code.  So choosing a consistent prefix gives you the best solution for this case.

I think you'll be OK with this - see the sample in the code snippet.

best regards, ~Ray
<?php session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Success Associates Webinar Request</title>
</head>
<body>
 
<form  name="webinarsfdotcom" action="https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="post">
 
<input type=hidden name="oid" value="#################">
<input type=hidden name="retURL" value="http://www.successassociates.com/">
 
<?php
//data for Salesforce.com
// validation expected data exists
 
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$company =  $_POST['company'];
$street =  $_POST['street'];
$city =  $_POST['city'];
$state =  $_POST['state'];
$zip =  $_POST['zip'];
$country =  $_POST['country'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$sf_00N80000002tVKI = $_POST['00N80000002tVKI'];
$sf_00N80000002tVKX = $_POST['00N80000002tVKX'];
$sf_00N80000002tVKY = $_POST['00N80000002tVKY'];
$sf_00N80000002tVL6 = $_POST['00N80000002tVL6'];
 
// store name/email in session variables
$_SESSION['first_name'] = $first_name;
$_SESSION['last_name'] = $last_name;
$_SESSION['company'] = $company;
$_SESSION['street'] = $street;
$_SESSION['city'] = $city;
$_SESSION['state'] = $state;
$_SESSION['zip'] = $zip;
$_SESSION['country'] = $country;
$_SESSION['email'] = $email;
$_SESSION['phone'] = $phone;
$_SESSION['00N80000002tVKI'] = $sf_00N80000002tVKI;
$_SESSION['00N80000002tVKX'] = $sf_00N80000002tVKX;
$_SESSION['00N80000002tVKY'] = $sf_00N80000002tVKY;
$_SESSION['00N80000002tVL6'] = $sf_00N80000002tVL6;
?>
 
<input type="hidden"  name="first_name"                         id="first_name"                                 value= "<?php  echo $first_name ?>" / >
<input type="hidden"  name="last_name"                          id="last_name"                                  value= "<?php  echo $last_name ?>" / >
<input type="hidden"  name="company"                            id="company"    maxlength="40"                  value= "<?php  echo $company ?>" / >
<input type="hidden"  name="street"                             id="street"                                     value= "<?php  echo $street ?>" / >
<input type="hidden"  name="state"                              id="state"                                      value= "<?php  echo $state ?>" / >
<input type="hidden"  name="zip"                                id="zip"                                        value= "<?php  echo $zip ?>" / >
<input type="hidden"  name="country"                            id="country"                                    value= "<?php  echo $country ?>" / >
<input type="hidden"  name="phone"                              id="phone"                                      value= "<?php  echo $phone ?>" / >
<input type="hidden"  name="email"                              id="email"                                      value= "<?php  echo $email ?>" / >
<input type="hidden"  name="lead_source"                        id="lead_source"                                value= "Webinar" >
<input type="hidden"  name="00N80000002tVKI"        id="00N80000002tVKI"                    value= "<?php  echo $sf_00N80000002tVKI ?>" / >
<input type="hidden"  name="00N80000002tVKX"        id="00N80000002tVKX"                    value= "<?php  echo $sf_00N80000002tVKX ?>" / >
<input type="hidden"  name="00N80000002tVKY"        id="00N80000002tVKY"                    value= "<?php  echo $sf_00N80000002tVKY ?>" / >
<input type="hidden"  name="00N80000002tVL6"        id="00N80000002tVL6"                    value= "<?php  echo $sf_00N80000002tVL6 ?>" / >
 
 
<?php
//Test inputed email for proper format
if(!$email or !strstr($email,"@") or !strstr($email,"."))
{
die ("<a href= \"# \" onclick= \"history.back(); \"><h2>Please go back and complete or enter a valid email address.</a>");
}
 
if(empty($first_name) || empty($last_name) ||  empty($company) || empty($street) || empty($city) || empty($state) || empty($zip) || empty($country) || empty($email) || empty($phone)) {
//echo "<h2>Use Back - Please Complete All Required Information</h2>\n";
die ("<a href= \"# \" onclick= \"history.back(); \">Click Here to Go Back and Complete All Required Information</a>");
}
 
$todayis = date("l, F j, Y, g:i a") ;
 
 
 
 
</form>
 
<script language="JavaScript">
document."webinarsfdotcom".submit();
</script>
 
<?php }
else {
  // fetch name/email from session
  $first_name = $_SESSION['first_name'];
  $last_name = $_SESSION['last_name'];
  $email = $_SESSION['email'];
}
 
?>
 
<p align="center">
<?php $todayis = date("l, F j, Y, g:i a")?>
Date: <?php echo $todayis ?>
<br />
Thank You : <?php echo $first_name." ".$last_name ?> ( <?php echo $email ?>). Your request was submitted. We will contact you today or on the next business day.
 
<!--Remember to change the address back to production site -->
<a href="http://www.successassociates.com"> Next Page </a>
</p>
 
</body>
</html>

Open in new window

0
 
Ray PaseurCommented:
Not to dodge your question, but by all means, ask Salesforce how this is handled.  You cannot be the first person to hit this, and they probably have the answer in their FAQ somewhere.
0
 
Ray PaseurCommented:
Also, can you show us some of the code you're using now?  I'm thinking that if I see it I may have some ideas that will help.  Thanks, ~Ray
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

 
s_c_alderferAuthor Commented:
As a part of the web to lead implementation, Salesforce provides an html page to use to collect and post the data.  I am trying to integrate in our existing website which uses PHP.  I am a beginner, so I'm reluctant to recreate what we currently have in html.

I asked SF.com support if they could rename the custom fields, but they have a black box that generates custom fields, so they can not change the fields.

Attached is the code I created before I remembered that PHP variables can not begin with a number.

Thanks

<?php session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Success Associates Webinar Request</title>
</head>
<body>
 
<form  name="webinarsfdotcom" action="https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="post">
 
<input type=hidden name="oid" value="#################">
<input type=hidden name="retURL" value="http://www.successassociates.com/">
 
<?php
//data for Salesforce.com
// validation expected data exists
 
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$company =  $_POST['company'];
$street =  $_POST['street'];
$city =  $_POST['city'];
$state =  $_POST['state'];
$zip =  $_POST['zip'];
$country =  $_POST['country'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$00N80000002tVKI = $_POST['00N80000002tVKI'];
$00N80000002tVKX = $_POST['00N80000002tVKX'];
$00N80000002tVKY = $_POST['00N80000002tVKY'];
$00N80000002tVL6 = $_POST['00N80000002tVL6'];
 
// store name/email in session variables
$_SESSION['first_name'] = $first_name;
$_SESSION['last_name'] = $last_name;
$_SESSION['company'] = $company;
$_SESSION['street'] = $street;
$_SESSION['city'] = $city;
$_SESSION['state'] = $state;
$_SESSION['zip'] = $zip;
$_SESSION['country'] = $country;
$_SESSION['email'] = $email;
$_SESSION['phone'] = $phone;
$_SESSION['00N80000002tVKI'] = $00N80000002tVKI;
$_SESSION['00N80000002tVKX'] = $00N80000002tVKX;
$_SESSION['00N80000002tVKY'] = $00N80000002tVKY;
$_SESSION['00N80000002tVL6'] = $00N80000002tVL6;
?>
 
<input type="hidden"  name="first_name"  			id="first_name"                			value= "<?php  echo $first_name ?>" / >
<input type="hidden"  name="last_name"   			id="last_name"                 			value= "<?php  echo $last_name ?>" / >
<input type="hidden"  name="company"     			id="company"    maxlength="40" 			value= "<?php  echo $company ?>" / >
<input type="hidden"  name="street"     			id="street"                   			value= "<?php  echo $street ?>" / >
<input type="hidden"  name="state"       			id="state"                     			value= "<?php  echo $state ?>" / >
<input type="hidden"  name="zip"         			id="zip"                       			value= "<?php  echo $zip ?>" / >
<input type="hidden"  name="country"     			id="country"                   			value= "<?php  echo $country ?>" / >
<input type="hidden"  name="phone"       			id="phone"                     			value= "<?php  echo $phone ?>" / >
<input type="hidden"  name="email"       			id="email"                     			value= "<?php  echo $email ?>" / >
<input type="hidden"  name="lead_source" 			id="lead_source"               			value= "Webinar" >
<input type="hidden"  name="00N80000002tVKI"        id="00N80000002tVKI"                    value= "<?php  echo $00N80000002tVKI ?>" / >
<input type="hidden"  name="00N80000002tVKX"        id="00N80000002tVKX"                    value= "<?php  echo $00N80000002tVKX ?>" / >
<input type="hidden"  name="00N80000002tVKY"        id="00N80000002tVKY"                    value= "<?php  echo $00N80000002tVKY ?>" / >
<input type="hidden"  name="00N80000002tVL6"        id="00N80000002tVL6"                    value= "<?php  echo $00N80000002tVL6 ?>" / >
 
 
<?php
//Test inputed email for proper format
if(!$email or !strstr($email,"@") or !strstr($email,"."))
{
die ("<a href= \"# \" onclick= \"history.back(); \"><h2>Please go back and complete or enter a valid email address.</a>");
}
 
if(empty($first_name) || empty($last_name) ||  empty($company) || empty($street) || empty($city) || empty($state) || empty($zip) || empty($country) || empty($email) || empty($phone)) {
//echo "<h2>Use Back - Please Complete All Required Information</h2>\n";
die ("<a href= \"# \" onclick= \"history.back(); \">Click Here to Go Back and Complete All Required Information</a>");
}
 
$todayis = date("l, F j, Y, g:i a") ;
 
 
 
 
</form>
 
<script language="JavaScript">
document."webinarsfdotcom".submit();
</script>
 
<?php }
else {
  // fetch name/email from session
  $first_name = $_SESSION['first_name'];
  $last_name = $_SESSION['last_name'];
  $email = $_SESSION['email'];
}
 
?>
 
<p align="center">
<?php $todayis = date("l, F j, Y, g:i a")?>
Date: <?php echo $todayis ?>
<br />
Thank You : <?php echo $first_name." ".$last_name ?> ( <?php echo $email ?>). Your request was submitted. We will contact you today or on the next business day.
 
<!--Remember to change the address back to production site -->
<a href="http://www.successassociates.com"> Next Page </a>
</p>
 
</body>
</html>

Open in new window

0
 
s_c_alderferAuthor Commented:
Ray:

I updated my code, and I can see the data passing from the request page to the request process page, but it is not making it to Salesforce.  

I included the code for both the input page, request.php and the webinarprocess.php page, and a screen shot of the data, and phpinfo that I added to the webinarprocess.php page.

I have another page that is similar, but simpler that uses Javascript to submit and that works.  

I tried using Fiddler, while testing and didn't see the Post to Salesforce.  I compared the JavaScript to the page that works and the format is exactly the same.

Thanks
Request.php
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Request a Webinar</title>
<link href="/sa_stylesheet.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
 
</head>
<body marginwidth="0" marginheight="0" bgcolor="#cccccc" leftmargin="0" topmargin="0">
<form action="webinarprocess.php" method="post">
 
<table border="0" cellpadding="0" cellspacing="0" width="100%">
 
 
<tbody>
<tr>
<td bgcolor="#cccccc" valign="top">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td background="/images/spacer_lft_blue_one.gif">&nbsp;</td>
<td width="16"><img alt="" src="/images/spacer_lft_blue_two.gif" width="16" height="59"></td></tr></tbody></table>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td background="/images/spacer_gray.gif" height="1"><img alt="" src="/images/spacer_gray.gif" width="1" height="1"></td></tr></tbody></table>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td background="/images/spacer_mid_blue_two.gif">&nbsp;</td>
<td width="26"><img alt="" src="/images/spacer_mid_blue_one.gif" width="26" height="246"></td></tr></tbody></table>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td background="/images/spacer_black.gif"><img alt="" src="/images/spacer_black.gif" width="1" height="1"></td></tr></tbody></table></td>
<td valign="top" width="705">
<table border="0" cellpadding="0" cellspacing="0" width="705">
<tbody>
<tr>
<td width="1"><img alt="" src="/images/spacer_gray.gif" width="1" height="108"></td>
<td background="/images/spacer_header.gif"><img alt="" src="/images/sa_logo.gif" width="320" height="108"></td>
<td width="1"><img alt="" src="/images/spacer_gray.gif" width="1" height="108"></td></tr></tbody></table>
<table border="0" cellpadding="0" cellspacing="0" width="705">
<tbody>
<tr>
<td height="1"><img alt="" src="/images/spacer_black.gif" width="705" height="1"></td></tr></tbody></table>
<table border="0" cellpadding="0" cellspacing="0" width="705">
<tbody>
<tr>
<td width="1"><img alt="" src="/images/spacer_black.gif" width="1" height="197"></td>
<td width="465"><img alt="" src="/images/fa_images/fa_contact_us.gif" width="465" height="197"></td>
<td width="238"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="238" height="197">
<param name="movie" value="/images/flash_nav/sa_contact_us_nav.swf">
<param name="quality" value="high"><embed src="/images/flash_nav/sa_contact_us_nav.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="238" height="197"></embed></object></td>
<td width="1"><img alt="" src="/images/spacer_black.gif" width="1" height="197"></td></tr></tbody></table>
<table border="0" cellpadding="0" cellspacing="0" width="705">
<tbody>
<tr>
<td><img alt="" src="/images/spacer_black.gif" width="705" height="1"></td></tr></tbody></table>
<table bgcolor="#ffffff" border="0" cellpadding="0" cellspacing="0" width="705">
<tbody>
<tr>
<td background="/images/spacer_gray.gif" valign="top" width="1"><img alt="" src="/images/spacer_gray.gif" width="1" height="1"></td>
<td valign="top" width="448">
<table border="0" cellpadding="0" cellspacing="0" width="448">
<tbody>
<tr valign="top">
<td width="28"><img alt="" src="/images/arrow_main.gif" width="28" height="44"></td>
<td style="padding-top: 8px;">
<font size="4" face="Arial" color="#002e69">Request A Free Webinar</font>
<table class="BlackText" border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" width="350">
<tbody>
<tr>
<td>
 
<table border="0" cellpadding="0" cellspacing="5" width="350">
<tbody>
<tr>
<td colspan="2" class="BlackText"><br>
 
 
 
<?php
$ipi = getenv("REMOTE_ADDR");
$httprefi = getenv ("HTTP_REFERER");
$httpagenti = getenv ("HTTP_USER_AGENT");
?>
<input type="hidden" name="ip" value="<?php echo $ipi ?>" />
<input type="hidden" name="httprefi" value="<?php echo $httprefi ?>" />
<input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />
<input type="hidden" name="lead_source", value = "web contact" />
 
 <font color="#ff6600">Fields
                                      marked with an asterisk(*) are required!</font></td></tr>
<tr class="BlackText">
<td>First Name:<font color="#ff6600"> *</font></td>
<td> <input style="background-color: yellow" name="first_name" id="first_name" size="20" type="text"><span class="BlackText"> </span> </td></tr>
<tr class="BlackText">
<td>Last Name:<font color="#ff6600"> *</font></td>
<td> <input style="background-color: yellow" name="last_name" id="last_name" size="50" type="text"><span class="BlackText"> </span> </td></tr>
<tr class="BlackText">
<td> Company/Agency:<font color="#ff6600">*</font></td>
<td> <input style="background-color: yellow" name="company" id="company" size="50" type="text"><span class="BlackText"> </span> </td></tr>
<tr class="BlackText">
<td> Street:<font color="#ff6600"> *</font></td>
<td> <input style="background-color: yellow" name="street" id="street" size="40" type="text"><span class="BlackText"> </span> </td></tr>
<tr class="BlackText">
<td>City:<font color="#ff6600"> *</font></td>
<td> <input style="background-color: yellow" name="city" id="city" size="40" type="text"><span class="BlackText"> </span> </td></tr>
<tr class="BlackText">
<td> State/Province:<font color="#ff6600"> *</font> </td>
<td> <input style="background-color: yellow" name="state" id="state" size="20" type="text"><span class="BlackText"> </span> </td></tr>
<tr class="BlackText">
<td> Zip/Postal Code:<font color="#ff6600"> *</font> </td>
<td> <input style="background-color: yellow" name="zip" id="zip" size="20" type="text"><span class="BlackText"> </span> </td></tr>
<tr class="BlackText">
<td> Country:<font color="#ff6600"> *</font> </td>
<td> <input style="background-color: yellow" name="country" id="country" size="40" type="text"><span class="BlackText"> </span> </td></tr>
<tr class="BlackText">
<td>Phone:<font color="#ff6600"> *</font></td>
<td> <input style="background-color: yellow" name="phone" id="phone" size="40" type="text"><span class="BlackText"> </span> </td></tr>
<tr class="BlackText">
<td> E-Mail:<font color="#ff6600"> *</font> </td>
<td> <input style="background-color: yellow" name="email" id="email" size="40" type="text"><span class="BlackText"> </span> </td></tr>
<tr>
<td colspan="2">   </td></tr></tbody></table></td></tr></tbody></table>
<p>Success Associates does not share or sell e-mail addresses
                          collected via our Web site to third-parties. For our
                          complete Privacy Policy, <a href="/privacy_policy.html" class="LightBlueLinks">click
                          here</a>.</p></td></tr>
<tr>
<td>&nbsp;</td></tr></tbody></table></td>
<td width="28"><img alt="" src="/images/spacer_white.gif" width="28" height="44"></td></tr></tbody></table></td>
<td background="/images/dotted_line.gif" valign="top" width="2"><img alt="" src="/images/dotted_line.gif" width="2" height="4"></td>
<td valign="top">
<table border="0" cellpadding="0" cellspacing="0" width="253">
<tbody>
<tr>
<td><img alt="" src="/images/au.gif" width="253" height="26"></td></tr>
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" width="253">
<tbody>
 
 
<tr class="BlackText"><td  style="padding-left: 10px; style="padding-top: 5px;">
<B>1. Preference in how we may contact you?</B></td></tr>
<tr class="BlackText"><td style="padding-left: 20px;">
<input name="00N80000002tVKI" type="checkbox"  value="byphone">
 By Phone <br>
<input name="00N80000002tVKI" type="checkbox"  value="byemail">
 By Email</td>
 </tr>
 
<tr class="BlackText"><td  style="padding-left: 10px; padding-top: 10px;"><b>
What subjects should we discuss?</b></td></tr><br>
<tr class="BlackText"><td  style="padding-left: 10px;"><b>
Please check all that apply:</b></td></tr>
 
<tr class="BlackText"><td  style="padding-left: 10px; padding-top: 15px;"><b>2. Your General Interest:</b></td></tr>
<tr class="BlackText"><td  style="padding-left: 20px;"><input name="00N80000002tVKX" type="checkbox" value="Seminars and Workshops">Seminars and Workshops</td></tr>
<tr class="BlackText"><td  style="padding-left: 20px;"><input name="00N80000002tVKX" type="checkbox" value="Consulting Services">Consulting Services</td></tr>
<tr class="BlackText"><td  style="padding-left: 20px;"><input name="00N80000002tVKX" type="checkbox" value="Software as a Service">Software as a Service</td></tr>
 
 
 
 
<tr class="BlackText">
 
<td  style="padding-left: 10px; padding-top: 15px;"><b>3. Your Specific Interests:</b></td></tr>
<tr class="BlackText"><td  style="padding-left: 20px;"><input name="00N80000002tVKY" type="checkbox" value="Executive Briefing">Executive Briefing</td></tr>
<tr class="BlackText"><td  style="padding-left: 20px;"><input name="00N80000002tVKY" type="checkbox" value="Obtain Executive Support">Obtaining Executive Support</td></tr>
<tr class="BlackText"><td  style="padding-left: 20px;"><input name="00N80000002tVKY" type="checkbox" value="Show Process Rating Models">Show Process Rating Models</td></tr>
<tr class="BlackText"><td  style="padding-left: 20px;"><input name="00N80000002tVKY" type="checkbox" value="10 Step Walkthrough">10 Step Walk Through</td></tr>
<tr class="BlackText"><td  style="padding-left: 20px;"><input name="00N80000002tVKY" type="checkbox" value="Software Demonstration">Software Demonstration</td></tr>
<tr class="BlackText"><td  style="padding-left: 20px;"><input name="00N80000002tVKY" type="checkbox" value="Case Studies and References">Case Studies / References</td></tr>
<tr class="BlackText"><td  style="padding-left: 20px;"><input name="00N80000002tVKY" type="checkbox" value="Pricing Information">Pricing Information</td></tr>
 
<tr class="BlackText">
 
<td  style="padding-left: 10px; padding-top: 15px; padding-right: 35px;">4. May we email you a confidential 5 minute survey to learn more  about your organization, objectives, experience with succession planning, and your availability to schedule the webinar with you? </td></tr>
<tr class="BlackText"><td  style="padding-left: 20px;"><input name="00N80000002tVL6" type="checkbox" value="Yes">Yes</td></tr>
<tr class="BlackText"><td  style="padding-left: 20px;"><input name="00N80000002tVL6" type="checkbox" value="No Thanks">No Thanks.</td></tr>
 
<tr><td style="padding-top: 15px; text-align: center;"> <input type="submit" value="Submit Request" /></td></tr>
 
 
 
 
 
 
<td><img alt="" src="/images/spacer_white.gif" width="15" height="25"></td></tr></tbody></table></td></tr></tbody></table>
<table border="0" cellpadding="0" cellspacing="0" width="253">
<tbody>
<tr>
<td></td></tr>
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" width="253">
<tbody>
<tr>
<td><img alt="" src="/images/spacer_white.gif" width="15" height="30"></td>
<td class="BlackText"></td>
<td>&nbsp;</td></tr>
<tr valign="top">
<td width="15">&nbsp;</td>
<td>
<div align="right"></div><br>
</td>
<td width="15"><img alt="" src="/images/spacer_white.gif" width="15" height="25"></td></tr></tbody></table></td></tr></tbody></table> </td>
<td background="/images/spacer_gray.gif" valign="top" width="1"><img alt="" src="/images/spacer_gray.gif" width="1" height="1"></td></tr></tbody></table>
<table border="0" cellpadding="0" cellspacing="0" width="705">
<tbody>
<tr>
<td width="1"><img alt="" src="/images/spacer_dr_blue.gif" width="1" height="58"></td>
<td background="/images/spacer_bottom_border.gif">
<div align="center">
<table border="0" cellpadding="0" cellspacing="5" width="703">
<tbody>
<tr>
<td>
<div class="WhiteText" align="center">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td width="69%">
<div align="right"><a href="/index.html" class="WhiteLinks">home</a>
                              &nbsp;<span class="WhiteText">|</span> &nbsp;<a href="/about_us/" class="WhiteLinks">about
                              us</a>&nbsp; <span class="WhiteText">|</span> &nbsp;<a href="/services/services.html" class="WhiteLinks">services</a>&nbsp; <span class="WhiteText">|</span> &nbsp;<a href="/clients/" class="WhiteLinks">clients</a>&nbsp; <span class="WhiteText">|</span> &nbsp;<a href="/contact_us/" class="WhiteLinks">contact
                              us</a> </div></td>
<td width="31%">
<div align="right"><a href="/privacy_policy.html" class="WhiteLinks">privacy</a>&nbsp; <span class="WhiteText">|</span> &nbsp;<a href="/legal.html" class="WhiteLinks">legal</a><img alt="" src="/images/spacer_bottom_border.gif" width="20" height="1"></div></td></tr></tbody></table></div></td></tr>
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td class="GrayText" width="66%">
<div align="center">&#169;
                            2008 Success Associates, LLC.<a href="http://www.movingminds.info/" target="_blank" class="GrayLinks"> <br>
</a></div></td></tr></tbody></table></td></tr></tbody></table></div></td>
<td width="1"><img alt="" src="/images/spacer_dr_blue.gif" width="1" height="58"></td></tr></tbody></table></td>
<td bgcolor="#cccccc" valign="top">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td width="16"><img alt="" src="/images/spacer_lft_blue_two_b.gif" width="16" height="59"></td>
<td background="/images/spacer_lft_blue_one_b.gif">&nbsp;</td></tr></tbody></table>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td background="/images/spacer_gray.gif" height="1"><img alt="" src="/images/spacer_gray.gif" width="1" height="1"></td></tr></tbody></table>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td width="26"><img alt="" src="/images/spacer_mid_blue_one_b.gif" width="26" height="246"></td>
<td background="/images/spacer_mid_blue_two_b.gif">&nbsp;</td></tr></tbody></table>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td background="/images/spacer_black.gif"><img alt="" src="/images/spacer_black.gif" width="1" height="1"></td></tr></tbody></table></td></tr></tbody></table>
</form>
</body>
</html>
 
 
======================================================================
webinarprocess.php
 
<?php session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Success Associates Webinar Request</title>
</head>
<body>
 
<form  name="webinarsfdotcom" action="https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="post">
 
<input type=hidden name="oid" value="###############">
<input type=hidden name="retURL" value="http://www.successassociates.com/">
 
<?php
//data for Salesforce.com
// validation expected data exists
 
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$company =  $_POST['company'];
$street =  $_POST['street'];
$city =  $_POST['city'];
$state =  $_POST['state'];
$zip =  $_POST['zip'];
$country =  $_POST['country'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$sf_00N80000002tVKI = $_POST['00N80000002tVKI'];
$sf_00N80000002tVKX = $_POST['00N80000002tVKX'];
$sf_00N80000002tVKY = $_POST['00N80000002tVKY'];
$sf_00N80000002tVL6 = $_POST['00N80000002tVL6'];
 
// store name/email in session variables
$_SESSION['first_name'] = $first_name;
$_SESSION['last_name'] = $last_name;
$_SESSION['company'] = $company;
$_SESSION['street'] = $street;
$_SESSION['city'] = $city;
$_SESSION['state'] = $state;
$_SESSION['zip'] = $zip;
$_SESSION['country'] = $country;
$_SESSION['email'] = $email;
$_SESSION['phone'] = $phone;
$_SESSION['00N80000002tVKI'] = $sf_00N80000002tVKI;
$_SESSION['00N80000002tVKX'] = $sf_00N80000002tVKX;
$_SESSION['00N80000002tVKY'] = $sf_00N80000002tVKY;
$_SESSION['00N80000002tVL6'] = $sf_00N80000002tVL6;
?>
 
<input type="hidden"  name="first_name"                         id="first_name"                                 value= "<?php  echo $first_name ?>" / >
<input type="hidden"  name="last_name"                          id="last_name"                                  value= "<?php  echo $last_name ?>" / >
<input type="hidden"  name="company"                            id="company"    maxlength="40"                  value= "<?php  echo $company ?>" / >
<input type="hidden"  name="street"                             id="street"                                     value= "<?php  echo $street ?>" / >
<input type="hidden"  name="state"                              id="state"                                      value= "<?php  echo $state ?>" / >
<input type="hidden"  name="zip"                                id="zip"                                        value= "<?php  echo $zip ?>" / >
<input type="hidden"  name="country"                            id="country"                                    value= "<?php  echo $country ?>" / >
<input type="hidden"  name="phone"                              id="phone"                                      value= "<?php  echo $phone ?>" / >
<input type="hidden"  name="email"                              id="email"                                      value= "<?php  echo $email ?>" / >
<input type="hidden"  name="lead_source"                        id="lead_source"                                value= "Webinar" />
<input type="hidden"  name="00N80000002tVKI"        			id="00N80000002tVKI"                    		value= "<?php  echo $sf_00N80000002tVKI ?>" / >
<input type="hidden"  name="00N80000002tVKX"        			id="00N80000002tVKX"                    		value= "<?php  echo $sf_00N80000002tVKX ?>" / >
<input type="hidden"  name="00N80000002tVKY"        			id="00N80000002tVKY"                    		value= "<?php  echo $sf_00N80000002tVKY ?>" / >
<input type="hidden"  name="00N80000002tVL6"        			id="00N80000002tVL6"                    		value= "<?php  echo $sf_00N80000002tVL6 ?>" / >
 
 
<?php
//Test inputed email for proper format
if(!$email or !strstr($email,"@") or !strstr($email,"."))
{
die ("<a href= \"# \" onclick= \"history.back(); \"><h2>Please go back and complete or enter a valid email address.</a>");
}
 
if(empty($first_name) || empty($last_name) ||  empty($company) || empty($street) || empty($city) || empty($state) || empty($zip) || empty($country) || empty($email) || empty($phone)) {
//echo "<h2>Use Back - Please Complete All Required Information</h2>\n";
die ("<a href= \"# \" onclick= \"history.back(); \">Click Here to Go Back and Complete All Required Information</a>");
}
 
$todayis = date("l, F j, Y, g:i a") ;
?>
 
 
 
</form>
 
<script language="JavaScript">
document."webinarsfdotcom".submit();
</script>
 
 
 
 
 
 
<?php //}  end of if($_POST);
//else {
  // fetch name/email from session
  $first_name = $_SESSION['first_name'];
  $last_name = $_SESSION['last_name'];
  $email = $_SESSION['email'];
//}
 
?>
 
<p align="center">
<?php $todayis = date("l, F j, Y, g:i a")?>
Date: <?php echo $todayis ?>
<br />
Thank You : <?php echo $first_name." ".$last_name ?> ( <?php echo $email ?>). Your request was submitted. We will contact you today or on the next business day.
 
<!--Remember to change the address back to production site -->
<a href="http://www.successassociates.com"> Next Page </a>
 
<?php
 
phpinfo()
?>
 
</p>
 
</body>
</html>

Open in new window

Screenshots.doc
0
 
Ray PaseurCommented:
Wow, that's a lot of code.  I may not be bale to get through all of it, but I can tell you where I see some issues.  First, this is paraphrased from lines near #176 in that code snippet.  If you install it and run it you will see that it does not work - it only gives the value for the last checkbox.
<?php // RAY_temp_checkboxes.php
error_reporting(E_ALL);
echo "<pre>\n";
 
// IF ANYTHING IS POSTED
if (!empty($_POST))
{
   var_dump($_POST);
}
// END OF PHP
// THE FORM BELOW IS DEFECTIVE.  ONLY THE LAST CHECKBOX VALUE WILL COME THROUGH
?>
<form method="post">
 
<p>3. Your Specific Interests:<br/>
<br/><input name="00N80000002tVKY" type="checkbox" value="Executive Briefing">Executive Briefing
<br/><input name="00N80000002tVKY" type="checkbox" value="Obtain Executive Support">Obtaining Executive Support
<br/><input name="00N80000002tVKY" type="checkbox" value="Show Process Rating Models">Show Process Rating Models
<br/><input name="00N80000002tVKY" type="checkbox" value="10 Step Walkthrough">10 Step Walk Through
<br/><input name="00N80000002tVKY" type="checkbox" value="Software Demonstration">Software Demonstration
<br/><input name="00N80000002tVKY" type="checkbox" value="Case Studies and References">Case Studies / References
<br/><input name="00N80000002tVKY" type="checkbox" value="Pricing Information">Pricing Information
</p>
 
<input type="submit" />
</form>

Open in new window

0
 
Ray PaseurCommented:
Here is something that is more like what you probably want to use...
<?php // RAY_temp_checkboxes.php
error_reporting(E_ALL);
echo "<pre>\n";
 
// IF ANYTHING IS POSTED
if (!empty($_POST))
{
   var_dump($_POST);
}
// END OF PHP
// THE FORM BELOW IS CORRECT.  ALL OF THE CHECKBOX VALUES WILL COME THROUGH IN AN ARRAY
?>
<form method="post">
 
<p>3. Your Specific Interests:<br/>
<br/><input name="00N80000002tVKY[]" type="checkbox" value="Executive Briefing">Executive Briefing
<br/><input name="00N80000002tVKY[]" type="checkbox" value="Obtain Executive Support">Obtaining Executive Support
<br/><input name="00N80000002tVKY[]" type="checkbox" value="Show Process Rating Models">Show Process Rating Models
<br/><input name="00N80000002tVKY[]" type="checkbox" value="10 Step Walkthrough">10 Step Walk Through
<br/><input name="00N80000002tVKY[]" type="checkbox" value="Software Demonstration">Software Demonstration
<br/><input name="00N80000002tVKY[]" type="checkbox" value="Case Studies and References">Case Studies / References
<br/><input name="00N80000002tVKY[]" type="checkbox" value="Pricing Information">Pricing Information
</p>
 
<input type="submit" />
</form>

Open in new window

0
 
Ray PaseurCommented:
Near line 245, there is this:

<div align="center">&#169;
                            2008 Success Associates, LLC.<a href="http://www.movingminds.info/" target="_blank" class="GrayLinks"> <br>
</a></div>

If you replace '2008' with <?=date('Y')?> the copyright year will update automatically.
0
 
Ray PaseurCommented:
Near line 336, there is this:

<input type="hidden"  name="00N80000002tVKI"                          id="00N80000002tVKI"                                value= "<?php  echo $sf_00N80000002tVKI ?>" / >

It appears that the echo statement will be trying to print an array, and that may not work as expected.  Run this and you can see what will happen...
<?php // RAY_temp_checkboxes.php
error_reporting(E_ALL);
echo "<pre>\n";
 
// IF ANYTHING IS POSTED
if (!empty($_POST))
{
   var_dump($_POST);
}
 
 
// SHOW WHAT HAPPENS WHEN YOU TRY TO PRINT AN ARRAY WITH echo
echo "\n\n\n\n"; // SPACING
$sf_00N80000002tVKY = $_POST["00N80000002tVKY"];
echo $sf_00N80000002tVKY;
echo "\n\n\n\n"; // SPACING
 
 
// END OF PHP
// THE FORM BELOW IS CORRECT.  ALL OF THE CHECKBOX VALUES WILL COME THROUGH IN AN ARRAY
?>
<form method="post">
 
<p>3. Your Specific Interests:<br/>
<br/><input name="00N80000002tVKY[]" type="checkbox" value="Executive Briefing">Executive Briefing
<br/><input name="00N80000002tVKY[]" type="checkbox" value="Obtain Executive Support">Obtaining Executive Support
<br/><input name="00N80000002tVKY[]" type="checkbox" value="Show Process Rating Models">Show Process Rating Models
<br/><input name="00N80000002tVKY[]" type="checkbox" value="10 Step Walkthrough">10 Step Walk Through
<br/><input name="00N80000002tVKY[]" type="checkbox" value="Software Demonstration">Software Demonstration
<br/><input name="00N80000002tVKY[]" type="checkbox" value="Case Studies and References">Case Studies / References
<br/><input name="00N80000002tVKY[]" type="checkbox" value="Pricing Information">Pricing Information
</p>
 
<input type="submit" />
</form>

Open in new window

0
 
Ray PaseurCommented:
On line 344, there is this:

if(!$email or !strstr($email,"@") or !strstr($email,"."))

Here is a function that will validate an email address and return TRUE or FALSE
// TEST FOR A VALID EMAIL ADDRESS, RETURN TRUE OR FALSE
function check_valid_email($email)
{
// IS THE PATTERN OF THE EMAIL ADDRESS OK?
    if (!preg_match('/^[A-Z0-9_-][A-Z0-9._-]*@([A-Z0-9][A-Z0-9-]*\.)+[A-Z]{2,6}$/i', $email)) return FALSE;
// IS THE DOMAIN OF THE EMAIL ADDRESS ROUTABLE OVER THE INTERNET FOR MX OR A RECORDS?
    $emaila = explode('@', $email);
    if ( checkdnsrr($emaila[1],"MX") || checkdnsrr($emaila[1],"A") ) return TRUE;
// NOT ROUTABLE
    return FALSE;
}

Open in new window

0
 
s_c_alderferAuthor Commented:
Ray:

Thanks for the feedback.  I changed the code so all the checked items in the form are being passed, and I can see the data if I use phpinfo.

The last problem is that the form data is not being sent to Salesforce.com.  If I watch the traffic it never gets submitted to Salesforce.   It does return the "Thank you" message that appears after the JavaScript code to submit.  I checked the Apache error log and there are no errors.

The current version of webinarrequest.php is included below.

Do you see any reason that would prevent the data from being submitted?

Thanks
<?php session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Success Associates Webinar Request</title>
</head>
 
<body>
 
<form  name="webinarsfdotcom" action="https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="post">
<input type=hidden name="oid" value="############">
<input type=hidden name="retURL" value="http://www.successassociates.com/">
 
<?php
//data for Salesforce.com
// validation expected data exists
 
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$company =  $_POST['company'];
$street =  $_POST['street'];
$city =  $_POST['city'];
$state =  $_POST['state'];
$zip =  $_POST['zip'];
$country =  $_POST['country'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$sf_00N80000002tVKI = $_POST['00N80000002tVKI'];
$sf_00N80000002tVKX = $_POST['00N80000002tVKX'];
$sf_00N80000002tVKY = $_POST['00N80000002tVKY'];
$sf_00N80000002tVL6 = $_POST['00N80000002tVL6'];
 
// store name/email in session variables
$_SESSION['first_name'] = $first_name;
$_SESSION['last_name'] = $last_name;
$_SESSION['company'] = $company;
$_SESSION['street'] = $street;
$_SESSION['city'] = $city;
$_SESSION['state'] = $state;
$_SESSION['zip'] = $zip;
$_SESSION['country'] = $country;
$_SESSION['email'] = $email;
$_SESSION['phone'] = $phone;
$_SESSION['00N80000002tVKI'] = $sf_00N80000002tVKI;
$_SESSION['00N80000002tVKX'] = $sf_00N80000002tVKX;
$_SESSION['00N80000002tVKY'] = $sf_00N80000002tVKY;
$_SESSION['00N80000002tVL6'] = $sf_00N80000002tVL6;
?>
 
<input type="hidden"  name="first_name"                         id="first_name"                                 value= "<?php  echo $first_name ?>" / >
<input type="hidden"  name="last_name"                          id="last_name"                                  value= "<?php  echo $last_name ?>" / >
<input type="hidden"  name="company"                            id="company"    maxlength="40"                  value= "<?php  echo $company ?>" / >
<input type="hidden"  name="street"                             id="street"                                     value= "<?php  echo $street ?>" / >
<input type="hidden"  name="state"                              id="state"                                      value= "<?php  echo $state ?>" / >
<input type="hidden"  name="zip"                                id="zip"                                        value= "<?php  echo $zip ?>" / >
<input type="hidden"  name="country"                            id="country"                                    value= "<?php  echo $country ?>" / >
<input type="hidden"  name="phone"                              id="phone"                                      value= "<?php  echo $phone ?>" / >
<input type="hidden"  name="email"                              id="email"                                      value= "<?php  echo $email ?>" / >
<input type="hidden"  name="lead_source"                        id="lead_source"                                value= "Webinar" />
<input type="hidden"  name="00N80000002tVKI"        			id="00N80000002tVKI"                    		value= "<?php  echo $sf_00N80000002tVKI ?>" / >
<input type="hidden"  name="00N80000002tVKX"        			id="00N80000002tVKX"                    		value= "<?php  echo $sf_00N80000002tVKX ?>" / >
<input type="hidden"  name="00N80000002tVKY"        			id="00N80000002tVKY"                    		value= "<?php  echo $sf_00N80000002tVKY ?>" / >
<input type="hidden"  name="00N80000002tVL6"        			id="00N80000002tVL6"                    		value= "<?php  echo $sf_00N80000002tVL6 ?>" / >
 
 
<?php
//Test inputed email for proper format
if(!$email or !strstr($email,"@") or !strstr($email,"."))
{
die ("<a href= \"# \" onclick= \"history.back(); \"><h2>Please go back and complete or enter a valid email address.</a>");
}
 
if(empty($first_name) || empty($last_name) ||  empty($company) || empty($street) || empty($city) || empty($state) || empty($zip) || empty($country) || empty($email) || empty($phone)) {
//echo "<h2>Use Back - Please Complete All Required Information</h2>\n";
die ("<a href= \"# \" onclick= \"history.back(); \">Click Here to Go Back and Complete All Required Information</a>");
}
 
$todayis = date("l, F j, Y, g:i a") ;
?>
 
 
 
</form>
 
<script language="JavaScript">
function submitform()
{
document."webinarsfdotcom".submit();
}
</script>
 
 
 
<?php //}
//end of if($_POST)
//else {
  // fetch name/email from session
  $first_name = $_SESSION['first_name'];
  $last_name = $_SESSION['last_name'];
  $email = $_SESSION['email'];
//}
 
?>
 
<p align="center">
<?php $todayis = date("l, F j, Y, g:i a")?>
Date: <?php echo $todayis ?>
<br />
Thank You : <?php echo $first_name." ".$last_name ?> ( <?php echo $email ?>). Your request was submitted. We will contact you today or on the next business day.
 
<!--Remember to change the address back to production site -->
<a href="http://www.successassociates.com"> Next Page </a>
 
 
</p>
 
</body>
</html>

Open in new window

0
 
Ray PaseurCommented:
Well, I was able to find this: function submitform() but I could not see where that function was being called, so maybe that is the issue.  The function is defined but not used?
0
 
s_c_alderferAuthor Commented:
I swapped code and just replaced it with what I had before.

<script language="JavaScript">
document.webinarsfdotcom.submit();
</script>

It did send data to Salesforce but the array data loaded as "array".

Thanks
0
 
Ray PaseurCommented:
'...the array data loaded as "array".'

Yes, that is what I was talking about at 24300273 and 24300282.  It appears that the code is taking an array of data and trying to "print" it into a single field at lines 61~64 of the most recent code snippet.  PHP does not work that way.  When you tell it to echo an array, it says, "array" and that is not usually what you want to see.

There needs to be some programming that extracts the elements from the array and sends those elements to Salesforce.com.  Does Salesforce.com expect multiple values in those fields?
0
 
s_c_alderferAuthor Commented:
For General Interest and Specific Interests Salesforce is configured to accept multiple items.  SF.com provided this html code snippet

Your General Interest::<select  id="00N80000002tVKX" multiple="multiple" name="00N80000002tVKX" title="Your General Interest:">
<option value="Seminars and Workshops">Seminars and Workshops</option>
<option value="Consulting Services">Consulting Services</option>
<option value="Software as a Service">Software as a Service</option>
</select><br>

Your Specific Interests:<select  id="00N80000002tVKY" multiple="multiple" name="00N80000002tVKY" title="Your Specific Interests:">
<option value="Executive Briefing">Executive Briefing</option>
<option value="Obtaining Executive Support">Obtaining Executive Support</option>
<option value="Show Process Rating Models">Show Process Rating Models</option>
<option value="10 Step Walk Through">10 Step Walk Through</option>
<option value="Software Demonstration">Software Demonstration</option>
<option value="Case Studies / References">Case Studies / References</option>
<option value="Pricing Information">Pricing Information</option>
</select><br>

Our site was setup to use check boxes, so I was trying to keep the checkboxes.

Would this method work:

<input type="hidden"  name="00N80000002tVKX"        id="00N80000002tVKX"                    value= "<?php  foreach ($sf_00N80000002tVKX as $GenInterest?) {
                  echo "$GenInterest" ?>" / >


Thanks for all your help.

0
 
Ray PaseurCommented:
Let's set up a test to see what the "select multiple" form field produces.  Then we can come up with an equivalent way of translating the checkboxes into the select statements.  I'll see if I can come up with a code sample.  Best, ~Ray
0
 
Ray PaseurCommented:
Install this, run it and see if it makes sense to you.  It looks like both the checkboxes and select options can be set up to produce an array.  To translate this array into a collection of hidden fields, you would need to iterate over the POST array and create the hidden input statements that recreated the expected input from the select or checkbox fields.
<?php // RAY_select_multiple.php
error_reporting(E_ALL);
// DATA FROM CHECKBOXES IS NAMED WITH 'c_'
// DATA FROM THE SELECT IS NAMED WITH 's_'
// DATA FROM THE HIDDEN IS NAMED WITH 'h_'
 
// IF THE DATA HAS BEEN POSTED
if (!empty($_POST))
{
    echo "<pre>\n";
    var_dump($_POST);
    echo "</pre>\n";
}
// END OF PHP
?>
<form method="post">
 
<input type="checkbox" name="c_option[]" value="Option 1" /> Option 1 <br/>
<input type="checkbox" name="c_option[]" value="Option 2" /> Option 2 <br/>
<input type="checkbox" name="c_option[]" value="Option 3" /> Option 3 <br/>
 
<br/>
 
<select multiple="multiple" name="s_option[]">
<option value="Option 1">Option 1</option>
<option value="Option 2">Option 2</option>
<option value="Option 3">Option 3</option>
</select>
 
<br/>
 
<input type="hidden" name="h_option[]" value="Option 1" />
<input type="hidden" name="h_option[]" value="Option 2" />
<input type="hidden" name="h_option[]" value="Option 3" />
 
<input type="submit" />
 
</form>

Open in new window

0
 
s_c_alderferAuthor Commented:
Ray:
Could I use implode to get the data into a string?

I tried using implode in webinarprocess.php below, but got these errors:

[Wed May 06 11:32:27 2009] [error] [client 127.0.0.1] PHP Notice:  Use of undefined constant sfi_00N80000002tVKX - assumed 'sfi_00N80000002tVKX' in C:\\Program Files\\Apache Group\\Apache2\\htdocs\\contact_us\\webinarprocess.php on line 49, referer: http://127.0.0.1:8080/contact_us/request.php
[Wed May 06 11:32:27 2009] [error] [client 127.0.0.1] PHP Notice:  Use of undefined constant sfi_00N80000002tVKY - assumed 'sfi_00N80000002tVKY' in C:\\Program Files\\Apache Group\\Apache2\\htdocs\\contact_us\\webinarprocess.php on line 50, referer: http://127.0.0.1:8080/contact_us/request.php
[Wed May 06 11:32:27 2009] [error] [client 127.0.0.1] PHP Notice:  Undefined variable: sfi_00N80000002tVKX in C:\\Program Files\\Apache Group\\Apache2\\htdocs\\contact_us\\webinarprocess.php on line 65, referer: http://127.0.0.1:8080/contact_us/request.php
[Wed May 06 11:32:27 2009] [error] [client 127.0.0.1] PHP Notice:  Undefined variable: sfi_00N80000002tVKY in C:\\Program Files\\Apache Group\\Apache2\\htdocs\\contact_us\\webinarprocess.php on line 66, referer: http://127.0.0.1:8080/contact_us/request.php           

Thanks
<?php session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Success Associates Webinar Request</title>
</head>
 
<body>
 
<form  name="webinarsfdotcom" action="https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="post">
<input type=hidden name="oid" value="############">
<input type=hidden name="retURL" value="http://www.successassociates.com/">
 
<?php
//data for Salesforce.com
// validation expected data exists
 
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$company =  $_POST['company'];
$street =  $_POST['street'];
$city =  $_POST['city'];
$state =  $_POST['state'];
$zip =  $_POST['zip'];
$country =  $_POST['country'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$sf_00N80000002tVKI = $_POST['00N80000002tVKI'];
$sf_00N80000002tVKX = $_POST['00N80000002tVKX'];
$sf_00N80000002tVKY = $_POST['00N80000002tVKY'];
$sf_00N80000002tVL6 = $_POST['00N80000002tVL6'];
 
// store name/email in session variables
$_SESSION['first_name'] = $first_name;
$_SESSION['last_name'] = $last_name;
$_SESSION['company'] = $company;
$_SESSION['street'] = $street;
$_SESSION['city'] = $city;
$_SESSION['state'] = $state;
$_SESSION['zip'] = $zip;
$_SESSION['country'] = $country;
$_SESSION['email'] = $email;
$_SESSION['phone'] = $phone;
$_SESSION['00N80000002tVKI'] = $sf_00N80000002tVKI;
$_SESSION['00N80000002tVKX'] = $sf_00N80000002tVKX;
$_SESSION['00N80000002tVKY'] = $sf_00N80000002tVKY;
$_SESSION['00N80000002tVL6'] = $sf_00N80000002tVL6;
$_SESSION[sfi_00N80000002tVKX]  = implode(", ",$sf_00N80000002tVKX);
$_SESSION[sfi_00N80000002tVKY]  = implode(", ",$sf_00N80000002tVKY);
?>
 
<input type="hidden"  name="first_name"                         id="first_name"                                 value= "<?php  echo $first_name ?>" / >
<input type="hidden"  name="last_name"                          id="last_name"                                  value= "<?php  echo $last_name ?>" / >
<input type="hidden"  name="company"                            id="company"    maxlength="40"                  value= "<?php  echo $company ?>" / >
<input type="hidden"  name="street"                             id="street"                                     value= "<?php  echo $street ?>" / >
<input type="hidden"  name="city"                               id="city"                                       value= "<?php  echo $city ?>" / >
<input type="hidden"  name="state"                              id="state"                                      value= "<?php  echo $state ?>" / >
<input type="hidden"  name="zip"                                id="zip"                                        value= "<?php  echo $zip ?>" / >
<input type="hidden"  name="country"                            id="country"                                    value= "<?php  echo $country ?>" / >
<input type="hidden"  name="phone"                              id="phone"                                      value= "<?php  echo $phone ?>" / >
<input type="hidden"  name="email"                              id="email"                                      value= "<?php  echo $email ?>" / >
<input type="hidden"  name="lead_source"                        id="lead_source"                                value= "Webinar" />
<input type="hidden"  name="00N80000002tVKI"        			id="00N80000002tVKI"                    		value= "<?php  echo $sf_00N80000002tVKI ?>" / >
<input type="hidden"  name="00N80000002tVKX"        			id="00N80000002tVKX"                            value= "<?php  echo $sfi_00N80000002tVKX ?>" / >
<input type="hidden"  name="00N80000002tVKY"        			id="00N80000002tVKY"                    		value= "<?php  echo $sfi_00N80000002tVKY ?>" / >
<input type="hidden"  name="00N80000002tVL6"        			id="00N80000002tVL6"                    		value= "<?php  echo $sf_00N80000002tVL6 ?>" / >
 
 
<?php
//Test inputed email for proper format
if(!$email or !strstr($email,"@") or !strstr($email,"."))
{
die ("<a href= \"# \" onclick= \"history.back(); \"><h2>Please go back and complete or enter a valid email address.</a>");
}
 
if(empty($first_name) || empty($last_name) ||  empty($company) || empty($street) || empty($city) || empty($state) || empty($zip) || empty($country) || empty($email) || empty($phone)) {
//echo "<h2>Use Back - Please Complete All Required Information</h2>\n";
die ("<a href= \"# \" onclick= \"history.back(); \">Click Here to Go Back and Complete All Required Information</a>");
}
 
$todayis = date("l, F j, Y, g:i a") ;
?>
 
 
 
</form>
 
<script language="JavaScript">
document.webinarsfdotcom.submit();
</script>
 
 
 
<?php //}
//end of if($_POST)
//else {
  // fetch name/email from session
  $first_name = $_SESSION['first_name'];
  $last_name = $_SESSION['last_name'];
  $email = $_SESSION['email'];
//}
 
?>
 
<p align="center">
<?php $todayis = date("l, F j, Y, g:i a")?>
Date: <?php echo $todayis ?>
<br />
Thank You : <?php echo $first_name." ".$last_name ?> ( <?php echo $email ?>). Your request was submitted. We will contact you today or on the next business day.
 
<!--Remember to change the address back to production site-->
<a href="http://www.successassociates.com"> Next Page </a>
 
 
</p>
 
</body>
</html>

Open in new window

request.php.txt
0
 
Ray PaseurCommented:
You might be able to use implode() for something, but more to the point, what format does SalesForce expect for these data fields?  Does SF expect a string of comma-separated values or an array?

The messages you got are not errors, they are PHP notices.  For example on line 49, this code:

$_SESSION[sfi_00N80000002tVKX]  = implode(", ",$sf_00N80000002tVKX);

...tells PHP that the $_SESSION field indexed by the DEFINEd constant sfi_00N80000002tVKX is to be updated with the results of implode().  You probably want to put the array index into quotes so that PHP will handle this right.

At this point I would suggest you step back from this problem and consider hiring a developer.  This has got a lot of moving parts and the code you've posted here evinces some pretty basic misunderstandings about how to use PHP.  If you would like some suggestions on learning resources for PHP please have a look at SitePoint (google 'em) and consider buying their books on developing web sites with PHP and MySQL.

Best regards, ~Ray
0
 
s_c_alderferAuthor Commented:
Ray:

The the fields in Salesforce are looking for string data not an array.  It can be coma space or just a coma.

I think I'll try to use individual named fields for each checkbox and then concatenate them to send them to Salesforce

Point taken about basic misunderstandings, I am trying to get  up to speed using the resources through IEEE Computer Society.  They have Element-K courses and a pretty good selection of O'Reilly books online.

Our company is a startup and I'm wearing several hats.

Thanks for your help!
0
 
Ray PaseurCommented:
The individual named fields approach sounds like it should work.  Best of luck - I understand the "many hats" needed in a startup, ~Ray
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.