您好我希望获得一个强大的专业网络表单,以便在提交按钮被拒绝后将数据发送到我的crm系统
我有90%编码,但由于某种原因,它只是不通过
发送信息我已经使用wordpress的代码片段插件将它添加到我的网站,并设置了片段,当提交表单x时它应该将各种数据位发布到crm系统
强大的专业表格中的数据以下列格式输出[21],或[18]等我从数据周围删除了这组括号 - 因为格式中已经有一组括号[]
附加了crm系统的开发人员指南和示例代码以及我自己90%开发的代码,为什么它没有连接?
我的代码
add_action('frm_after_create_entry', 'yourfunctionname', 30, 2);
function yourfunctionname($entry_id, $form_id){
if($form_id == 2){ //replace 5 with the id of the form
//set POST variables
$url = 'https://secure4.mortgagekeeperonline.co.uk/mywebsitelink/php/NewMortgageQuickDetails.php'; // Your system URL
$fields = array(
'StagePK'=>urlencode(25), // Must set Stage
'AdvisorPK'=>urlencode(1), //Must set Adviser
'MortgageMode'=>urlencode(0), // 'CommercialMode'=>urlencode(1), [IF CommercialKeeper}
//Commercial Deatils
'CompanyName'=>urlencode($_POST['companyName']),
'ComAddressLine1'=>urlencode($_POST['companyAddressLine1']),
'ComAddressLine2'=>urlencode($_POST['companyAddressLine2']),
'ComAddressLine3'=>urlencode($_POST['companyAddressLine3']),
'ComPostcode'=>urlencode($_POST['companyPostcode']),
'ComTelephone'=>urlencode($_POST['Office']),
'ComEmail'=>urlencode($_POST['Email']),
'LegalStatus'=>urlencode(3),
//Mortgage Details
'LenderPK'=>urlencode(1),
'InterestRateTypePK'=>urlencode(2),
'Rate'=>urlencode(3.45),
'DealTerm'=>urlencode(5),
'Term'=>urlencode(25),
'ActionPK'=>urlencode(11),
'ActionText'=>urlencode($_POST['Notes']),
//Applicant Details
'Title1'=>urlencode($_POST['10']),
'Forename1'=>urlencode($_POST['9']),
'Surname1'=>urlencode($_POST['15']),
'Email'=>urlencode($_POST['149']),
'DayPhone'=>urlencode($_POST['28']),
'MobilePhone'=>urlencode($_POST['29']),
'Title2'=>urlencode($_POST['12']),
'Forename2'=>urlencode($_POST['11']),
'Surname2'=>urlencode($_POST['16']),
'MidNameApp1'=>urlencode($_POST['13']),
'MidNameApp2'=>urlencode($_POST['14']),
//Fact Find Questions
'FFVersionPK12'=>urlencode(5), //Must set which FactFind
'FFQuestionPK[1]'=>11884,
'FFAnswer[1]'=>urlencode($_POST['23']), // looking to
'FFQuestionPK[2]'=>11885,
'FFAnswer[2]'=>urlencode($_POST['24']), // credit history
// Just increment the FFQuestionPK and FFAnswer numbers in the square brackets by 1
// Replace the ???? in 'FFQuestionPK[3]'=>????, with the FactFind Question PK number
// and replace the ??? in 'FFAnswer[3]'=>urlencode($_POST['????']), with your form post value
'FFQuestionPK[3]'=>11463,
'FFAnswer[3]'=>urlencode($_POST['43']), // property value
'FFQuestionPK[4]'=>9164,
'FFAnswer[4]'=>urlencode($_POST['57']), // existing loans summary
'FFQuestionPK[5]'=>11466,
'FFAnswer[5]'=>urlencode($_POST['71']), // term of mortgage
'FFQuestionPK[6]'=>11465,
'FFAnswer[6]'=>urlencode($_POST['44']), // mortgage required
'FFQuestionPK[7]'=>8829,
'FFAnswer[7]'=>urlencode($_POST['17']), // app1 DOB
'FFQuestionPK[8]'=>9772,
'FFAnswer[8]'=>urlencode($_POST['18']), // app2 dob
'FFQuestionPK[9]'=>11886,
'FFAnswer[9]'=>urlencode($_POST['19']), // app1 nationality
'submit'=>true //Do not remove
);
//url-ify the data for the POST
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string,'&');
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
//execute post
$result = curl_exec($ch);
//Debug
//var_dump($result);
//var_dump(curl_getinfo($ch));
//Generate eMail (If Required)
$name1 = $_POST['Forename'];
$name2 = $_POST['Surname'];
$phone = $_POST['Office'];
$email = $_POST['Email'];
$comments = $_POST['companyName'];
$message = "*** This is a message sent from the website contact form ***\r\n\r\n";
$message .= "Contact Name: $name1 $name2\r\n";
$message .= "Contact Number: $phone\r\n";
$message .= "Email: $email\r\n";
$message .= "Business: $comments\r\n\r\n------------ END -------------";
if(mail('info@DOMAIN.co.uk', 'Website Contact Form', $message, "From: YOU@DOMAIN.co.uk\r\n")) {
$emailStatus = 'Form Sent.';
}else{
$emailStatus = 'Form Not Sent. Please contact NAME on TELEPHONE.';
}
//close connection
curl_close($ch);
}
}
==end code==
the developers example code was
<?php
//set POST variables
$url = 'https://secure.mortgagekeeperonline.co.uk/SITENAME/php/NewMortgageQuickDetails.php'; // Your system URL
$fields = array(
'StagePK'=>urlencode(1), // Must set Stage
'AdvisorPK'=>urlencode(4), //Must set Adviser
'MortgageMode'=>urlencode(1), // 'CommercialMode'=>urlencode(1), [IF CommercialKeeper}
//Commercial Deatils
'CompanyName'=>urlencode($_POST['companyName']),
'ComAddressLine1'=>urlencode($_POST['companyAddressLine1']),
'ComAddressLine2'=>urlencode($_POST['companyAddressLine2']),
'ComAddressLine3'=>urlencode($_POST['companyAddressLine3']),
'ComPostcode'=>urlencode($_POST['companyPostcode']),
'ComTelephone'=>urlencode($_POST['Office']),
'ComEmail'=>urlencode($_POST['Email']),
'LegalStatus'=>urlencode(3),
//Mortgage Details
'LenderPK'=>urlencode(1),
'InterestRateTypePK'=>urlencode(2),
'Rate'=>urlencode(3.45),
'DealTerm'=>urlencode(5),
'Term'=>urlencode(25),
'ActionPK'=>urlencode(11),
'ActionText'=>urlencode($_POST['Notes']),
//Applicant Details
'Title1'=>urlencode($_POST['Title']),
'Forename1'=>urlencode($_POST['Forename']),
'Surname1'=>urlencode($_POST['Surname']),
'Email'=>urlencode($_POST['Email']),
'DayPhone'=>urlencode($_POST['Office']),
'MobilePhone'=>urlencode($_POST['Mobile']),
//Fact Find Questions
'FFVersionPK'=>urlencode(5), //Must set which FactFind
'FFQuestionPK[1]'=>11604,
'FFAnswer[1]'=>urlencode($_POST['datemoved1']),
'FFQuestionPK[2]'=>11636,
'FFAnswer[2]'=>urlencode($_POST['basic1']),
// Just increment the FFQuestionPK and FFAnswer numbers in the square brackets by 1
// Replace the ???? in 'FFQuestionPK[3]'=>????, with the FactFind Question PK number
// and replace the ??? in 'FFAnswer[3]'=>urlencode($_POST['????']), with your form post value
'FFQuestionPK[3]'=>????,
'FFAnswer[3]'=>urlencode($_POST['????']),
'submit'=>true //Do not remove
);
//url-ify the data for the POST
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string,'&');
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
//execute post
$result = curl_exec($ch);
//Debug
//var_dump($result);
//var_dump(curl_getinfo($ch));
//Generate eMail (If Required)
$name1 = $_POST['Forename'];
$name2 = $_POST['Surname'];
$phone = $_POST['Office'];
$email = $_POST['Email'];
$comments = $_POST['companyName'];
$message = "*** This is a message sent from the website contact form ***\r\n\r\n";
$message .= "Contact Name: $name1 $name2\r\n";
$message .= "Contact Number: $phone\r\n";
$message .= "Email: $email\r\n";
$message .= "Business: $comments\r\n\r\n------------ END -------------";
if(mail('info@DOMAIN.co.uk', 'Website Contact Form', $message, "From: YOU@DOMAIN.co.uk\r\n")) {
$emailStatus = 'Form Sent.';
}else{
$emailStatus = 'Form Not Sent. Please contact NAME on TELEPHONE.';
}
//close connection
curl_close($ch);
}
}
?>
<!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 charset="utf-8">
<meta name="robots" content="noarchive">
<TITLE>Contact Form</TITLE>
<meta content="text/html; charset=utf-8" http-equiv=Content-Type>
</HEAD>
<BODY>
<div>
<?php echo "Email Status: $emailStatus"; ?>
<form method="post" action="">
<table width="450px" border="0">
<th colspan="2">Company Details</th>
<tr>
<td valign="top"> <label for="companyName">Company Name</label> </td>
<td valign="top"> <input type="text" name="companyName" value="<?php echo $_POST['companyName']; ?>" /> </td>
</tr>
<tr>
<td valign="top"> <label for="companyAddressLine1">Company Address</label> </td>
<td valign="top"> <input type="text" name="companyAddressLine1" value="<?php echo $_POST['companyAddressLine1']; ?>"/> </td>
</tr>
<tr>
<td valign="top"> <label for="companyAddressLine2"></label> </td>
<td valign="top"> <input type="text" name="companyAddressLine2" value="<?php echo $_POST['companyAddressLine2']; ?>"/> </td>
</tr>
<tr>
<td valign="top"> <label for="companyAddressLine3">Town</label> </td>
<td valign="top"> <input type="text" name="companyAddressLine3" value="<?php echo $_POST['companyAddressLine3']; ?>"/> </td>
</tr>
<tr>
<td valign="top"> <label for="companyPostcode">Postcode</label> </td>
<td valign="top"> <input type="text" name="companyPostcode" value="<?php echo $_POST['companyPostcode']; ?>"/> </td>
</tr>
<th colspan="2">Your Details</th>
<tr>
<td valign="top"> <label for="Title">Title</label> </td>
<td valign="top"> <select name="Title">
<option value="1">Mr</option>
<option value="2">Mrs</option>
<option value="3">Miss</option>
<option value="4">Ms</option>
</select> </td>
</tr>
<tr>
<td valign="top"> <label for="Forename">First Name</label> </td>
<td valign="top"> <input type="text" name="Forename" value="<?php echo $_POST['Forename']; ?>"/> </td>
</tr>
<tr>
<td valign="top"> <label for="surname">Surname</label> </td>
<td valign="top"> <input type="text" name="Surname" value="<?php echo $_POST['Surname']; ?>"/> </td>
</tr>
<tr>
<td valign="top"> <label for="Email">Email</label> </td>
<td valign="top"> <input type="text" name="Email" value="<?php echo $_POST['Email']; ?>"/> </td>
</tr>
<tr>
<td valign="top"> <label for="Office">Office Telephone</label> </td>
<td valign="top"> <input type="text" name="Office" value="<?php echo $_POST['Office']; ?>"/> </td>
</tr>
<tr>
<td valign="top"> <label for="Mobile">Mobile</label> </td>
<td valign="top"> <input type="text" name="Mobile" value="<?php echo $_POST['Mobile']; ?>"/> </td>
</tr>
<tr>
<td valign="top"> <input name="submitButton" type="submit" value="Submit"> <a href=""></a> </td>
</tr>
</table>
</form>
</DIV>
</BODY>
</HTML>
答案 0 :(得分:0)
您可以像在页面中所说的那样使用class RestaurantMenuAdapter (val context : Context) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
val inflater = parent.context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
return object : RecyclerView.ViewHolder(inflater.inflate(R.layout.item_menu1, parent, false)) {
}
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
}
override fun getItemCount(): Int {
return 10
}
}
:https://formidableforms.com/knowledgebase/frm_after_create_entry/