Michael_Cooley
New Members-
Posts
6 -
Joined
-
Last visited
Michael_Cooley's Achievements
Newbie (1/5)
0
Reputation
-
Ok, got the dropdown to display. Figured out that I had to rename the field something other than $interest. So the form is rendering correctly, but the variable is not getting passed into Primary Interest.
-
Here's my revised code. The dropdown is not showing up on the page. <?php function getFormType($form){?> <?php /* DONT PUT ANYTHING ABOVE THIS POINT */ ?> <?php if($form->form_type == 'mediwarecontact'){ ?> <?php $form->startForm(); ?> <?php /*REMOVE THE FIELDS YOU DON'T WANT IN YOUR FORM AND ADD HTML WHERE NEEDED*/ ?> <?php echo $form->headerText; ?> <?php echo $form->topContent; ?> <div class='column-one' style='width:34%;'> <?php echo $form->firstName;?> <?php echo $form->lastName; ?> <?php echo $form->title; ?> <?php echo $form->phone; ?> <?php echo $form->email; ?> </div> <div class='column-two' style='width:33%;'> <?php echo $form->company; ?> <?php echo $form->address; ?> <?php echo $form->state; ?> <?php echo $form->phoneExt; ?><br /> </div> <div class='column-three' style='width:33%;'> <?php echo $form->interest; ?> <?php echo $form->commentBox; ?><br /> <?php $form->hiddenFields(); ?> <?php echo $form->demo; ?> <?php echo $form->pricing; ?> <?php echo $form->emailSubscriptions; ?> </div> <?php echo $form->submitButton; ?> <?php $form->endForm(); ?> <?php } ?> <?php } ?> <?php mortyForm(); ?> <?php Class Form { public $firstName = "<span id='FirstNameSpan' class='uk-form-row'> <label class='uk-form-label'> First Name </label><br /> <span class='mktInput'> <input class='mktFormText mktFormString mktFReq' name='FirstName' id='FirstName' size='' type='text' value='' maxlength='255' tabIndex='1' /> <span class='mktFormMsg'></span> </span><br /> </span>"; public $lastName = "<span id='LastNameSpan' class='uk-form-row'> <label class='uk-form-label'> Last Name </label><br /> <span class='mktInput'> <input class='mktFormText mktFormString mktFReq' name='LastName' id='LastName' size='23' type='text' value='' maxlength='255' tabIndex='2' /> <span class='mktFormMsg'></span> </span><br /> </span> "; public $email = " <span id='EmailSpan' class='uk-form-row'> <label class='uk-form-label'> Email </label><br /> <span class='mktInput'> <input class='mktFormText mktFormEmail mktFReq' name='Email' id='Email' size='23' type='text' value='' maxlength='255' tabIndex='5' /> <span class='mktFormMsg'></span> </span> </span> "; public $phone = " <span id='PhoneTable' class='uk-form-row'> <label class='uk-form-label'> Phone Number </label><br /> <span class='mktInput'> <input class='mktFormText mktFormPhone' name='Phone' id='Phone' size='23' type='text' value='' maxlength='255' tabIndex='3' /> <span class='mktFormMsg'></span> </span><br /> </span> "; public $title = " <span id='TitleSpan' class='uk-form-row'> <label class='uk-form-label'> Title </label><br /> <span class='mktInput'> <input class='mktFormText mktFormString' name='Title' size='23' type='text' value='' maxlength='255' tabIndex='4' /> <span class='mktFormMsg'></span> </span><br /> </span> "; public $phoneExt = " <label class='uk-form-label' class='uk-form-row'> Phone Ext. </label><br /> <span class='mktInput'> <input class='mktFormText mktFormString' name='Phone_Extension__c' id='Phone_Extension__c' size='23' type='text' value='' maxlength='8' tabIndex='9' /> <span class='mktFormMsg'></span> </span> "; public $company = " <span id='CompanySpan' class='uk-form-row'> <label class='uk-form-label'> Facility Name </label><br /> <span class='mktInput'> <input class='mktFormText mktFormString mktFReq' name='Company' size='23' id='Company' type='text' value='' maxlength='255' tabIndex='6' /> <span class='mktFormMsg'></span> </span><br /> </span> "; public $address = " <span id='AddressSpan' class='uk-form-row'> <label class='uk-form-label'> Street Address </label><br /> <span class='mktInput'> <input class='mktFormText mktFormString mktFReq' name='Address' size='23' id='Address' type='text' value='' maxlength='255' tabIndex='7' /> <span class='mktFormMsg'></span> </span><br /> </span> "; public $state = " <span id='StateTable' class='uk-form-row'> <label class='uk-form-label'> Zip </label><br /> <span class='mktInput'> <input class='mktFormText mktFormString mktFReq' name='PostalCode' id='PostalCode' size='23' type='text' value='' maxlength='255' tabIndex='8' /> <span class='mktFormMsg'></span> </span><br /> </span> "; public $submitButton = "<br /><input id='mktFrmSubmit' class='cta-button' type='button' style='margin-left:200px; width: 100px; overflow: visible; padding-left: .25em; padding-right: .25em; margin-top:60px; font-size:14px' name='submitButton' value='Submit' return false; />"; public $form_type = 'test'; public $followUpLevel; public $requestSubject; public $retURL; public $autoResponder; public $headerText; public $topContent; public $commentBox; public $primaryInterest; public $serviceLine; public $demo; public $pricing; public $emailSubscriptions; public $interest = " <span id='InterestSpan' class='uk-form-row'> <label class='uk-form-label'> Primary Interest </label><br /> <span class='mktInput'> <select name='interest' class='requestinfo' size='1' style='padding: 2px !important; margin-bottom: 10px;'> <option value='Blood' selected='selected'>Blood</option> <option value='Cellular Therapy'>Cellular Therapy</option> <option value='Home Care'>Home Care</option> <option value='Med Management'>Medication Mgmt</option> <option value='Rehabilitation'>Rehabilitation</option> <option value='Respiratory'>Respiratory</option> <option value='SHG - Performance'>Performance Mgmt</option> </select> <span class='mktFormMsg'></span> </span><br /> </span> "; function SetAll($form_type, $followUpLevel, $requestSubject, $retURL, $autoResponder, $headerText, $topContent, $commentBox, $primaryInterest, $serviceLine, $demo, $pricing, $emailSubscriptions, $interest){ $this->form_type = $form_type; $this->followUpLevel = $followUpLevel; $this->requestSubject = $requestSubject; $this->retURL = $retURL; $this->autoResponder = $autoResponder; $this->headerText = $headerText; $this->topContent = $topContent; $this->commentBox = $commentBox; $this->interest = $interest; $this->primaryInterest = $primaryInterest; $this->serviceLine = $serviceLine; $this->demo = $demo; $this->pricing = $pricing; $this->emailSubscriptions = $emailSubscriptions; } function startForm(){ ?> <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' type='text/javascript'></script> <script type='text/javascript' src='http://xxxxxxxx.com/js/formfunctions.js'></script> <form id='mktForm_1006' class='lpeRegForm formNotEmpty' action='http://app-o.marketo.com/index.php/leadCapture/save' method='post' name='mktForm_1006' enctype='application/x-www-form-urlencoded'> <script type='text/javascript'> function mktoGetForm() {return document.getElementById('mktForm_1006'); }</script> <?php } function endForm(){ ?> <span style='display:none;'><input type='text' name='_marketo_comments' value='' /></span> <input type='hidden' name='lpId' value='1050' /> <input type='hidden' name='subId' value='17' /> <input type='hidden' name='kw' value='' /> <input type='hidden' name='cr' value='' /> <input type='hidden' name='searchstr' value='' /> <input type='hidden' name='lpurl' value='http://na-o.marketo.com/lp/xxxxxx/GenericForm.html?cr={creative}&kw={keyword}' /> <input type='hidden' name='formid' value='1006' /> <input type='hidden' name='_mkt_disp' value='return' /> <input type='hidden' name='_mkt_trk' value='id:596-FKF-634&token:_mch-marketo.com-1330369410817-92622' /> <script type='text/javascript' src='http://na-o.marketo.com/js/mktFormSupport.js'></script> <script type='text/javascript'> function formSubmit(elt) { return Mkto.formSubmit(elt); } function formReset(elt) { return Mkto.formReset(elt); } </script> </form> <?php } function hiddenFields(){ $requestSubject = $this->requestSubject; $serviceLine = $this->serviceLine; $interest = (isset($_POST['interest']) && $_POST['interest'] != '') ? $_POST['interest'] : $serviceLine; $followUpLevel = $this->followUpLevel; $retURL = $this->retURL; $autoResponder = $this->autoResponder; ?> <input name='Request_Name' id='Request_Name' class='requestinfo' type='hidden' value="<?php echo $requestSubject; ?>" maxlength='255'/> <input name='Request_Type' id='Request_Type' class='requestinfo' type='hidden' value='Web' maxlength='255'/> <input name='Primary_Interest' id='Primary_Interest' class='requestinfo' type='hidden' value="<?php echo $interest; ?>" maxlength='255'/> <input name='Follow_Up_Level' id='Follow_Up_Level' class='requestinfo' type='hidden' value="<?php echo $followUpLevel; ?>" maxlength='255'/> <input name='Hide_Request_Info__c' id='Hide_Request_Info__c' maxlength='1500' type='hidden'> <input name='Hide_Cookie_Info__c' id='Hide_Cookie_Info__c' maxlength='1500' type='hidden'> <input name='Hide_Form_Comments__c' id='Hide_Form_Comments__c' class='' maxlength='1500' type='hidden'> <input type='hidden' id='returnURL' name='returnURL' value="<?php echo $retURL; ?>"/> <input type='hidden' id='retURL' name='retURL' value="<?php echo $retURL; ?>" /> <input name='Auto_Responder__c' id='Auto_Responder__c' type='hidden' value="<?php echo $autoResponder;?>" /> <?php } } ?> <?php function mortyForm(){ /* set the connection and login credentials to MYSQL */ $con = mysql_connect("localhost","user","password"); if (!$con){ die('Could not connect: ' . mysql_error()); } /* Connect to to MYSQL database */ mysql_select_db("database_table", $con); /* set the slug variable that will select the row from the database (the if statemenet handles if there are extra params in the url) */ $slug2 = 'http://www.'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; $slug = 'http://'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; if(strpos('http://'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"], '/?') || strpos('http://'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"], '?')){ $slug = substr('http://'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"], 0, strpos('http://'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"], '?')); $slug2 = substr('http://www.'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"], 0, strpos('http://'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"], '?')); } /* set the query to return matching rows */ $result = mysql_query("SELECT * FROM uber_forms WHERE page_url = '".$slug."' or page_url = '".$slug2."'"); while ($row = mysql_fetch_array($result)){ $form_type = $row['form_type']; $followUpLevel = $row['followup_level']; $requestSubject = $row['request_subject']; $retURL = $row['returl']; $autoResponder = $row['autoresponder']; $headerText = $row['header']; $primaryInterest = $row['primary_interest']; $serviceLine = $row['service_line']; $emailSubscriptions = $row['email_subscription']; if($row['demo'] == 1 && $row['pricing'] == 1){ $demo = "<input name='Demo_Request' id='Demo_Request' class='requestinfo chk' type='checkbox' value='false' />I want to schedule a demo<br />"; $pricing = "<input name='Pricing_Request' id='Pricing_Request' class='requestinfo chk' type='checkbox' value='false' />I want information on pricing<br />"; } else if($row['pricing'] == 1){ $pricing = "<input name='Pricing_Request' id='Pricing_Request' class='requestinfo' type='hidden' value='true' />"; $demo = "<input name='Demo_Request' id='Demo_Request' class='requestinfo' type='hidden' value='false' />"; } else if($row['demo'] == 1){ $demo = "<input name='Demo_Request' id='Demo_Request' class='requestinfo' type='hidden' value='true' />"; $pricing = "<input name='Pricing_Request' id='Pricing_Request' class='requestinfo' type='hidden' value='false' />"; } else{ $demo = "<input name='Demo_Request' id='Demo_Request' class='requestinfo chk' type='hidden' value='false' />"; $pricing = "<input name='Pricing_Request' id='Pricing_Request' class='requestinfo chk' type='hidden' value='false' />"; } $commentBox = "<label>".$row['comment_box']."</label>"; if($row['top_content'] != NULL){ $topContent = "<div class='top-content'>".$row['top_content']."</div>"; } /* if the comment_box column has any characters in it at all (including blanks) set the commentbox var to the textarea */ if($row['comment_box'] != NULL){ $commentBox .= "<textarea class='mktFormText mktFormString formcomments' id='Comment_Question__c' name='Comment_Question__c'></textarea>"; } else{ $commentBox = NULL; } } $form = new Form; $form->SetAll($form_type, $followUpLevel, $requestSubject, $retURL, $autoResponder, $headerText, $topContent, $commentBox, $primaryInterest, $serviceLine, $demo, $pricing, $emailSubscriptions, $interest); getFormType($form); mysql_close($con); } ?>
-
I am including the dropdown list in the table. I add the HTML in the comment field and it generates the list. I think the javascript that gets called passes that input and the comments into one field in Marketo that is separated by semicolons. Then some other custom-built piece of Salesforce programming takes that field and splits it back up into different fields in Salesforce. I hadn't even considered the fact that the dropdown was being swept up in that javascript. This is why the whole thing is so confusing. So, I need to create a field for the dropdown and then include it in the template?
-
Well, it didn't break anything, but it doesn't look like the variable came through. In an effort to show you what I am working with, here's the PHP with the sensitive bits removed. I drop a PHP include inside a module on the pages that I want, then I go to PHPmyAdmin and INSERT a new entry into the table. The PHP populates the Module with the correct template. Within this code I need to add my dropdown field, write it to a variable, and use some sort of IF ELSE logic to populate my Primary Interest. <?php function getFormType($form){?> <?php /* DONT PUT ANYTHING ABOVE THIS POINT */ ?> <?php if($form->form_type == 'download'){ ?> <?php $form->startForm(); ?> <h2><?php echo $form->headerText; ?></h2> <?php echo $form->topContent; ?> <?php echo $form->firstName;?> <?php echo $form->lastName; ?> <?php echo $form->company; ?> <?php echo $form->email; ?> <?php echo $form->phone; ?> <?php $form->hiddenFields(); ?> <?php echo $form->demo; ?> <?php echo $form->pricing; ?> <?php echo $form->emailSubscriptions; ?> <?php echo $form->submitButton; ?> <?php $form->endForm(); ?> <?php } ?> <?php if($form->form_type == 'tradeshow'){ ?> <?php $form->startForm(); ?> <h2><?php echo $form->headerText; ?></h2> <?php echo $form->topContent; ?> <?php echo $form->firstName;?> <?php echo $form->lastName; ?> <?php echo $form->company; ?> <?php echo $form->email; ?> <?php echo $form->phone; ?> <?php echo $form->commentBox; ?> <?php $form->hiddenFields(); ?> <?php echo $form->demo; ?> <?php echo $form->pricing; ?> <?php echo $form->emailSubscriptions; ?> <br /><?php echo $form->submitButton; ?> <?php $form->endForm(); ?> <?php } ?> <?php if($form->form_type == 'contact'){ ?> <?php $form->startForm(); ?> <?php echo $form->headerText; ?> <?php echo $form->topContent; ?> <div class='column-one' style='width:34%;'> <?php echo $form->firstName;?> <?php echo $form->lastName; ?> <?php echo $form->title; ?> <?php echo $form->phone; ?> <?php echo $form->email; ?> </div> <div class='column-two' style='width:33%;'> <?php echo $form->company; ?> <?php echo $form->address; ?> <?php echo $form->state; ?> <?php echo $form->phoneExt; ?><br /> </div> <div class='column-three' style='width:33%;'> <?php echo $form->commentBox; ?><br /> <?php $form->hiddenFields(); ?> <?php echo $form->demo; ?> <?php echo $form->pricing; ?> <?php echo $form->emailSubscriptions; ?> </div> <?php echo $form->submitButton; ?> <?php $form->endForm(); ?> <?php } ?> <?php /* * * * * Steps to making a new form template: * 1) Make a COPY of the following code, and paste it above in an empty line * 2) Enter a name where indicated making sure that the name is enclosed in single apostophes (e.g. 'myform') * 3) Remove any form fields that you don't wish to have on the form -- you MUST NOT REMOVE startForm, hiddenFields, submitButton, or endForm * 4) Demo and Pricing MUST COME AFTER hiddenFields, or the form will not work! * 5) Profit */ ?> <?php /* START COPYING HERE*/ ?> <?php if($form->form_type == '*************CHANGE THIS TO THE NAME YOU WANT TO USE AS FORM TEMPLATE*************'){ ?> <?php $form->startForm(); ?> <?php /*REMOVE THE FIELDS YOU DON'T WANT IN YOUR FORM AND ADD HTML WHERE NEEDED*/ ?> <?php echo $form->headerText; ?> <?php echo $form->topContent; ?> <?php echo $form->firstName;?> <?php echo $form->lastName; ?> <?php echo $form->title; ?> <?php echo $form->email; ?> <?php echo $form->phone; ?> <?php echo $form->phoneExt; ?> <?php echo $form->company; ?> <?php echo $form->address; ?> <?php echo $form->state; ?> <?php echo $form->commentBox; ?> <?php $form->hiddenFields(); ?> <?php echo $form->demo; ?> <?php echo $form->pricing; ?> <?php echo $form->emailSubscriptions; ?> <?php echo $form->submitButton; ?> </div> <?php $form->endForm(); ?> <?php } ?> <?php /* STOP COPYING HERE */ ?> <?php /* DONT PUT ANYTHING BELOW THIS POINT */ ?> <?php } ?> <?php mortyForm(); ?> <?php Class Form { public $firstName = "<span id='FirstNameSpan' class='uk-form-row'> <label class='uk-form-label'> First Name </label><br /> <span class='mktInput'> <input class='mktFormText mktFormString mktFReq' name='FirstName' id='FirstName' size='' type='text' value='' maxlength='255' tabIndex='1' /> <span class='mktFormMsg'></span> </span><br /> </span>"; public $lastName = "<span id='LastNameSpan' class='uk-form-row'> <label class='uk-form-label'> Last Name </label><br /> <span class='mktInput'> <input class='mktFormText mktFormString mktFReq' name='LastName' id='LastName' size='23' type='text' value='' maxlength='255' tabIndex='2' /> <span class='mktFormMsg'></span> </span><br /> </span> "; public $email = " <span id='EmailSpan' class='uk-form-row'> <label class='uk-form-label'> Email </label><br /> <span class='mktInput'> <input class='mktFormText mktFormEmail mktFReq' name='Email' id='Email' size='23' type='text' value='' maxlength='255' tabIndex='5' /> <span class='mktFormMsg'></span> </span> </span> "; public $phone = " <span id='PhoneTable' class='uk-form-row'> <label class='uk-form-label'> Phone Number </label><br /> <span class='mktInput'> <input class='mktFormText mktFormPhone' name='Phone' id='Phone' size='23' type='text' value='' maxlength='255' tabIndex='3' /> <span class='mktFormMsg'></span> </span><br /> </span> "; public $title = " <span id='TitleSpan' class='uk-form-row'> <label class='uk-form-label'> Title </label><br /> <span class='mktInput'> <input class='mktFormText mktFormString' name='Title' size='23' type='text' value='' maxlength='255' tabIndex='4' /> <span class='mktFormMsg'></span> </span><br /> </span> "; public $phoneExt = " <label class='uk-form-label' class='uk-form-row'> Phone Ext. </label><br /> <span class='mktInput'> <input class='mktFormText mktFormString' name='Phone_Extension__c' id='Phone_Extension__c' size='23' type='text' value='' maxlength='8' tabIndex='9' /> <span class='mktFormMsg'></span> </span> "; public $company = " <span id='CompanySpan' class='uk-form-row'> <label class='uk-form-label'> Facility Name </label><br /> <span class='mktInput'> <input class='mktFormText mktFormString mktFReq' name='Company' size='23' id='Company' type='text' value='' maxlength='255' tabIndex='6' /> <span class='mktFormMsg'></span> </span><br /> </span> "; public $address = " <span id='AddressSpan' class='uk-form-row'> <label class='uk-form-label'> Street Address </label><br /> <span class='mktInput'> <input class='mktFormText mktFormString mktFReq' name='Address' size='23' id='Address' type='text' value='' maxlength='255' tabIndex='7' /> <span class='mktFormMsg'></span> </span><br /> </span> "; public $state = " <span id='StateTable' class='uk-form-row'> <label class='uk-form-label'> Zip </label><br /> <span class='mktInput'> <input class='mktFormText mktFormString mktFReq' name='PostalCode' id='PostalCode' size='23' type='text' value='' maxlength='255' tabIndex='8' /> <span class='mktFormMsg'></span> </span><br /> </span> "; public $submitButton = "<br /><input id='mktFrmSubmit' class='cta-button' type='button' style='margin-left:200px; width: 100px; overflow: visible; padding-left: .25em; padding-right: .25em; margin-top:60px; font-size:14px' name='submitButton' value='Submit' return false; />"; public $form_type = 'test'; public $followUpLevel; public $requestSubject; public $retURL; public $autoResponder; public $headerText; public $topContent; public $commentBox; public $primaryInterest; public $serviceLine; public $demo; public $pricing; public $emailSubscriptions; function SetAll($form_type, $followUpLevel, $requestSubject, $retURL, $autoResponder, $headerText, $topContent, $commentBox, $primaryInterest, $serviceLine, $demo, $pricing, $emailSubscriptions){ $this->form_type = $form_type; $this->followUpLevel = $followUpLevel; $this->requestSubject = $requestSubject; $this->retURL = $retURL; $this->autoResponder = $autoResponder; $this->headerText = $headerText; $this->topContent = $topContent; $this->commentBox = $commentBox; $this->primaryInterest = $primaryInterest; $this->serviceLine = $serviceLine; $this->demo = $demo; $this->pricing = $pricing; $this->emailSubscriptions = $emailSubscriptions; } function startForm(){ ?> <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' type='text/javascript'></script> <script type='text/javascript' src='http://xxxxxxx.com/js/formfunctions.js'></script> <form id='mktForm_1006' class='lpeRegForm formNotEmpty' action='http://app-o.marketo.com/index.php/leadCapture/save' method='post' name='mktForm_1006' enctype='application/x-www-form-urlencoded'> <script type='text/javascript'> function mktoGetForm() {return document.getElementById('mktForm_1006'); }</script> <?php } function endForm(){ ?> <span style='display:none;'><input type='text' name='_marketo_comments' value='' /></span> <input type='hidden' name='lpId' value='1050' /> <input type='hidden' name='subId' value='17' /> <input type='hidden' name='kw' value='' /> <input type='hidden' name='cr' value='' /> <input type='hidden' name='searchstr' value='' /> <input type='hidden' name='lpurl' value='http://na-o.marketo.com/lp/xxxxxx/GenericForm.html?cr={creative}&kw={keyword}' /> <input type='hidden' name='formid' value='1006' /> <input type='hidden' name='_mkt_disp' value='return' /> <input type='hidden' name='_mkt_trk' value='id:596-FKF-634&token:_mch-xxxxxxx.com-1330369410817-92622' /> <script type='text/javascript' src='http://na-o.marketo.com/js/mktFormSupport.js'></script> <script type='text/javascript'> function formSubmit(elt) { return Mkto.formSubmit(elt); } function formReset(elt) { return Mkto.formReset(elt); } </script> </form> <?php } function hiddenFields(){ $requestSubject = $this->requestSubject; $intrest = (isset($_POST['intrest']) && $_POST['intrest'] != '') ? $_POST['intrest'] : $serviceLine; $serviceLine = $this->serviceLine; $followUpLevel = $this->followUpLevel; $retURL = $this->retURL; $autoResponder = $this->autoResponder; ?> <input name='Request_Name' id='Request_Name' class='requestinfo' type='hidden' value="<?php echo $requestSubject; ?>" maxlength='255'/> <input name='Request_Type' id='Request_Type' class='requestinfo' type='hidden' value='Web' maxlength='255'/> <input name='Primary_Interest' id='Primary_Interest' class='requestinfo' type='hidden' value="<?php echo $interest; ?>" maxlength='255'/> <input name='Follow_Up_Level' id='Follow_Up_Level' class='requestinfo' type='hidden' value="<?php echo $followUpLevel; ?>" maxlength='255'/> <input name='Hide_Request_Info__c' id='Hide_Request_Info__c' maxlength='1500' type='hidden'> <input name='Hide_Cookie_Info__c' id='Hide_Cookie_Info__c' maxlength='1500' type='hidden'> <input name='Hide_Form_Comments__c' id='Hide_Form_Comments__c' class='' maxlength='1500' type='hidden'> <input type='hidden' id='returnURL' name='returnURL' value="<?php echo $retURL; ?>"/> <input type='hidden' id='retURL' name='retURL' value="<?php echo $retURL; ?>" /> <input name='Auto_Responder__c' id='Auto_Responder__c' type='hidden' value="<?php echo $autoResponder;?>" /> <?php } } ?> <?php function mortyForm(){ /* set the connection and login credentials to MYSQL */ $con = mysql_connect("localhost","user","password"); if (!$con){ die('Could not connect: ' . mysql_error()); } /* Connect to to MYSQL database */ mysql_select_db("database_table", $con); /* set the slug variable that will select the row from the database (the if statemenet handles if there are extra params in the url) */ $slug2 = 'http://www.'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; $slug = 'http://'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; if(strpos('http://'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"], '/?') || strpos('http://'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"], '?')){ $slug = substr('http://'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"], 0, strpos('http://'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"], '?')); $slug2 = substr('http://www.'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"], 0, strpos('http://'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"], '?')); } /* set the query to return matching rows */ $result = mysql_query("SELECT * FROM uber_forms WHERE page_url = '".$slug."' or page_url = '".$slug2."'"); while ($row = mysql_fetch_array($result)){ $form_type = $row['form_type']; $followUpLevel = $row['followup_level']; $requestSubject = $row['request_subject']; $retURL = $row['returl']; $autoResponder = $row['autoresponder']; $headerText = $row['header']; $primaryInterest = $row['primary_interest']; $serviceLine = $row['service_line']; $emailSubscriptions = $row['email_subscription']; if($row['demo'] == 1 && $row['pricing'] == 1){ $demo = "<input name='Demo_Request' id='Demo_Request' class='requestinfo chk' type='checkbox' value='false' />I want to schedule a demo<br />"; $pricing = "<input name='Pricing_Request' id='Pricing_Request' class='requestinfo chk' type='checkbox' value='false' />I want information on pricing<br />"; } else if($row['pricing'] == 1){ $pricing = "<input name='Pricing_Request' id='Pricing_Request' class='requestinfo' type='hidden' value='true' />"; $demo = "<input name='Demo_Request' id='Demo_Request' class='requestinfo' type='hidden' value='false' />"; } else if($row['demo'] == 1){ $demo = "<input name='Demo_Request' id='Demo_Request' class='requestinfo' type='hidden' value='true' />"; $pricing = "<input name='Pricing_Request' id='Pricing_Request' class='requestinfo' type='hidden' value='false' />"; } else{ $demo = "<input name='Demo_Request' id='Demo_Request' class='requestinfo chk' type='hidden' value='false' />"; $pricing = "<input name='Pricing_Request' id='Pricing_Request' class='requestinfo chk' type='hidden' value='false' />"; } $commentBox = "<label>".$row['comment_box']."</label>"; if($row['top_content'] != NULL){ $topContent = "<div class='top-content'>".$row['top_content']."</div>"; } /* if the comment_box column has any characters in it at all (including blanks) set the commentbox var to the textarea */ if($row['comment_box'] != NULL){ $commentBox .= "<textarea class='mktFormText mktFormString formcomments' id='Comment_Question__c' name='Comment_Question__c'></textarea>"; } else{ $commentBox = NULL; } } $form = new Form; $form->SetAll($form_type, $followUpLevel, $requestSubject, $retURL, $autoResponder, $headerText, $topContent, $commentBox, $primaryInterest, $serviceLine, $demo, $pricing, $emailSubscriptions); getFormType($form); mysql_close($con); } ?>
-
Thanks Ch0cu3r. I'll give that a try.
-
Good afternoon! I will apologize upfront, because I am a complete novice when it comes to PHP. I know enough to really mess things up. So, I have inherited a PHP form that writes to MySQL table, then submits to Marketo and gets passed along to Salesforce. The programmer who wrote it, is no longer available and I need to change some of the code. In a nutshell, I have a hidden field (Primary Interest) that populates it's value based on a variable ($serviceLine) that gets entered when a new record is inserted into the table. I need to create a dropdown select that writes to a variable ($interest) for my form, then use that variable to populate Primary Interest, or default to $serviceLine if $interest is not present or NULL. Thanks in advance.