I am trying to integrate wordpress CF7 with a third party CRM.
I managed to send the data to the CRM using the following filter:
add_filter('wpcf7_form_action_url', 'wpcf7_custom_form_action_url');
function wpcf7_custom_form_action_url()
{
return 'https://www.myapps-systems.com/api/WebToLeed.asp';
}
Basically what i did is changing the "form action" from the regular CF7 to the WebtoLead action.
I also mapped the Cf7 form with the following attributes (taken from the CRm sample form):
[hidden mbp1 "222626"]
[hidden URLToReturn "http://thankyoupage.com/thankyou"]
[hidden Companies_Account_Status_Code "546"]
[hidden Companies_Company id:Companies_Company "Website Enquiry"]
<div>
[text* Contacts_Contact id:Contacts_Contact class:name]<label>name*:</label>
[tel* Companies_PhoneNumber id:Companies_PhoneNumber class:telelabelhone]
<label>phone*: </label>
[email Companies_Email id:Companies_Email class:email]<label> mail:</label>
[textarea Companies_Note 50x8 id:Companies_Note]<label>message:</label>
</div>
[submit onclick="return OnButton1(); id:send_contact class:submit]
So this did work for me and i managed to receive the data on the CRM, but as i need the data to be stored in the wordpress database as well, i would like it to be both send to the CRM and keep the regular wordpress functionality.And as I cannot use 2 "actions" in 1 form i have to use some different way.
I was trying to implement this by using a few methods , like using "wpcf7_before_send_mail" hook or "wpcf7_after_send_mail", and even using a 3'rd party integration plugin for CF7 (http://wordpress.org/plugins/contact-form-7-3rd-party-integration/screenshots/)
but unfortunatly with ot much success.
I would greatly appreciate your help on the matter.
Here is the full code of the sample Crm integration
<!--
URL is in action attribute.
For all inputs the name attribute is used by the back-end system so don't change them
-->
<form id="big_contact_form" name="Web2LeedForm" action="https://www.myapps-systems.com/api/WebToLeed.asp" method="POST" onsubmit="return submitForm();">
<input type="hidden" name="mbp1" value="222626"/>
<input type="hidden" name="URLToReturn" value="http://test.co.il/contact/thankyou"/>
<input type="hidden" name="Companies_Account_Status_Code" value="546" /> <!-- must be exactly this name and value -->
<input type="hidden" id="Companies_Company" name="Companies_Company" value="website enquiry"/> <!-- the Companies_Company field is mandatory, we don't use it so we just fill it with a value -->
<table>
<tr>
<td>*</td>
<th class="form_label"><label for="Contacts_Contact">name: </label></th>
<td><input class="input" type="text" id="Contacts_Contact" name="Contacts_Contact"/></td>
</tr>
<tr>
<td>*</td>
<th class="form_label"><label for="Companies_PhoneNumber">phone: </label></th>
<td><input class="input" type="text" id="Companies_PhoneNumber" name="Companies_PhoneNumber"/></td>
</tr>
<tr>
<td></td>
<th class="form_label"><label for="Companies_Email">mail: </label></th>
<td><input class="input" type="text" id="Companies_Email" name="Companies_Email"/></td>
</tr>
<tr>
<td></td>
<th class="form_label"><label for="Companies_Note">message:</label></th>
<td><textarea id="Companies_Note" name="Companies_Note" rows="8" cols="50"></textarea></td>
</tr>
<tr>
<td></td>
<td><input id="send_contact" name="submit" type="submit" value="שלח" /></td>
</tr>
</table>
</form>
Thank you
I managed to fix the problem using this great plugin:
http://wordpress.org/plugins/contact-form-7-3rd-party-integration/screenshots/
needs some modification but works great.
Related
I am using Bootstrap with jQuery and I'm facing issues when passing values from FORM to PHP, in this case the same page.
My code is:
<tr>
<td><input type="text" name="descricao[]" ></td>
<td><span class="spanpreco"><input type="text" name="quantidade[]" ></span></td>
<td><span class="spanpreco"><input type="text" name="preco[]"></span></td>
<td><input type="text" name="subtotal[]" disabled></td>
</tr>
Then my jquery goes like this:
$("#adicionar").click(function(){
$("#linha").append('<tr><td><input type="text" name="descricao[]"></td><td><span class="spanpreco"><input type="text" name="quantidade[]" ></span></td><td><span class="spanpreco"><input type="text" name="preco[]"></span></td><td><input type="text" name="subtotal[]" disabled></td></tr>');
});
The problem here is when I post the data to php, every single column that I dynamically add to the form will not pass to PHP, the result number of rows is always one.
Can someone help me here?
I found the issue, the <FORM></FORM> was on the wrong place.
Thanks and best regards,
Adelmo
im working on statestic wordpress plugin that allow the admin to get all the contributions of every contributor on the site daily, monthly .. etc, it have 3 pages, one contain a search button to search for username, the second page will contain the results of the name searched in first page, the 3rd page will contain a detailed report on every contribution durging a laps of time
i have create my plugin this way inside the plugin folder there is:
index.php
<?php
/**
* Plugin Name: wathefty
* Plugin URI: aaaaa
* Description:aaaaaaa .
* Version: aaaaa
* Author: aaaaa
* Author URI: aaaaa
**/
function wathefty_admin_actions() {
add_menu_page('wathefty stat Display', 'wathefty', 'manage_options', 'wathefty-stat-Display','wathefty_stat_Display');
}
function wathefty_stat_Display(){include('includes/wathefty-stat-Display.php');
}
add_action('admin_menu', 'wathefty_admin_actions');
?>
style/style.css
includes/whatefty-stat-display.php
<form action="admin.php?page=stats" method="post" >
<fieldset class="fieldset">
<legend class="legend">Search</legend>
<label class="label">Search by author name:</label>
<input class="input" type="text" name="click" />
<button class="button1" name="Submit" type="submit">Submit</button>
</fieldset>
</form>
includes/stats.php
<table class="table">
<thead class="thead">
<tr class="tr">
<td class="td" rowspan="2">Post author</td>
<td class="td" rowspan="2">Author category</td>
<td class="td" colspan="4">Number of posts</td>
</tr>
<tr class="tr">
<td class="td">Daily</td>
<td class="td">Weekly</td>
<td class="td">Monthly</td>
<td class="td">Yearly</td>
</tr>
</thead>
<tbody class="tbody">
<tr class="tbody">
<td class="td">wathefty</td>
<td class="td">admin</td>
<td class="td">10</td>
<td class="td">42</td>
<td class="td">321</td>
<td class="td">1485</td>
</tr>
</tbody>
</table>
includes/contributions.php
for now i didnt create function to do the job, my only problem is that when i click on submit to be redirected to stats page i get this error
wordpress You do not have sufficient permissions to access this page.
You don't have registered stats page in admin_pages.
Solution
Adjust your code in includes/whatefty-stat-display.php to something like this:
<?php
if( isset( $_POST['wathefty_submit'] ) ) {
include( dirname(__FILE__) . '/stats.php' );
}
?>
<form method="post" >
<fieldset class="fieldset">
<legend class="legend">Search</legend>
<label class="label">Search by author name:</label>
<input class="input" type="text" name="click" />
<button class="button1" name="wathefty_submit" type="submit">Submit</button>
</fieldset>
</form>
The main changes are in:
removing action attribute from <form>
including results (stats) page in same php file, in case there is $_POST['wathefty_submit'] set
Note that name attribute of submit button was changed.
Optionally, you could enclose the form in else branch, so the form wouldn't be displayed on stats page.
Alternative Solution
Alternative solution could be adding another menu page with add_menu_page function and including the second file there, but it doesn't seems to me right to have one menu page registered for form and other for results.
look at the values in the wp_usermeta table as follows:
wp_capabilities should be a:1:{s:13:"administrator";s:1:"1";}
wp_user_level should be 10
it will fixed the problem if wont could you please give the link which you used to open your plugin panel >
I have created a blog using PHP that submits a form into a MySQL databse. It works perfectly. What i want to know is how to get it to recognise when i've pressed enter to create a new line or to record a ' without getting a MySQL error. Basically i want to turn a normal submission form into a submission form like is used on this website.
<tr>
<td>Blog Title:</td>
<td><input type="text" id="edt" name="BlogTitle"></td>
</tr>
<tr>
<td>Blog Content:</td>
<td><textarea name="BlogCont" cols="50" rows="10" id="edt"></textarea></td>
</tr>
<tr>
<td><input type="hidden" name="Name" value="<?=$_SESSION['Name']?>"></td>
<td><input type="submit" id="but" value="Post"></td>
</tr>
Any help would be appreciated.
For new lines with enter use nl2br (manual), for apostrophe you have to escape it with mysql_real_escape_string (manual).
So Im relatively new to PHP from ASP. And After converting alot of ASP code into PHP I have come across a problem where my PHP code seems unable to find the hidden variable I have set. It worked fine in ASP and was just wondering the best way to resolve this.
Start of the Form:
<form name="LogIn" action="login.php" method="post">
<td bgColor=#ffffff>
<table align="center" cellSpacing="2" cellPadding="2" border="0">
<tr>
<td> </td>
<td align="right"><font color="#4d71a1">User name:</font> </td>
<td><input name="UserName" size="25" type="Text" autocomplete="OFF"></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td align="right"><font color="#4d71a1">Password:</font> </td>
<td><input name="Password" size="25" type="Password" autocomplete="OFF"></td>
<td> </td>
</tr>
PHP script:
<?
if ($_POST["BtnPress"]=="Pressed")
{
if ($_POST["Username"]=="*****" && $_POST["password"]=="*********")
{
$_SESSION['AdminID']="1";
header("Location: "."index.php");
}
else
{
print "<font color=#ff0000>Sorry you cannot access this part of the site.</font>";
}
}
?>
then the rest of the form:
<tr>
<td align="center" colspan="4">
<input type="hidden" name="BtnPress" value="Pressed">
<input type="Submit" value="Log In" class="mybutton" onclick="return CheckForm();">
</td>
</tr>
</table>
</td>
</form>
The PHP seems unable to find the variable BtnPress, its a similar problem throughout alot of my translated ASP to PHP script. Sorry if it is a simple solution but can anyone tell me where I am going wrong?
You have name="Password" and $_POST["password"]
Password != password
Watch your case.
<form name="LogIn" action="login.php" method="post">
<td bgColor=#ffffff>
That is invalid HTML. A <td> element cannot be a child element of a <form>. Browsers are likely to error recover in ways that break your HTML (e.g. by moving the form, but not its contents, outside the table). Do use a validator.
And stuff that isn't likely to be the cause of the problem, but is likely to be the cause of other problems.
Don't use layout tables
Do use the label element
Do use CSS for presentation (you can style your label elements instead of using the obsolete font element
Do not use a hidden input to test if a form is submitted.
use:
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// processing of $_POST
}
The name of the submit button should be "BtnPressed" not the hidden field.
What I would do would be to set the form action to ?id=submit or something like that, and then check "if $_GET['id'] == "submit" then process data.
<form action="login.php?do=submit">
.... <input .....
</form>
<?php
if($_GET['do'] == "submit"){
//process data
} ?>
Suppose I have a application form which contain lot of boxes like email,username,age etc...I have connected this application form to database(mysql) through action="register.php" in application form...
NOw i want that in database,username and email id should be unique.Means no two users cant have same username or email id..
What I know to do This....
When you created tables in mysql then make these fields (username,email) unique(by primary key).Butif i submit the form with same username already in database then error msj will be showed on the next page something like this.username is priamry.....whatever..
Problem in this...
The error msj should be displayed on the onblur event of that textbox(username textbox and email textbox)..
How i can do this.Please explain with example For your ease i am giving code for application form...something lik ethis
applicationform.php
form name="form" action="register.php" method="GET" >
<tr>
<td>Username</td>
<td><input type="text" id="username" size="30" maxlength="35" value=""></td>
<td><div id="p1"></div></td>
</tr>
<tr>
<td>Email</td>
<td><input type="text" id="email" size="30" maxlength="30" value=""></td>
</tr>
<tr>
<td align="center" colspan="100"> <input type="submit" name="submit" value="Submit">
</td>
</tr>
I think you have to make an Ajax request when the blur event happens and check at the server side whether the the username exists or not.
This AutoCompleter tutorial should give you the right idea how to do this.