我正在尝试本教程。我创建了一个 index.php,其中包含一个带有以下代码的表单。问题是表单根本没有提交。不调用警报。什么都没有发生。
<?php
require_once ('/soapclient/inc_connection.php');
function insert()
// if(isset($_POST['submit']))
{
//Describing the Leads object and printing the array
$describe = $connection->describeSObjects(array('Lead'));
print_r($describe);
//Create New Lead
$leadFirstName = "Ahmed";
$leadLastName = "Dirie";
$leadCompany = "Pick Yours Up";
$leadEmail = "adirie@pickyoursup.com";
//Creating the Lead Object
$lead = new stdClass;
$lead->type = 'Lead';
$lead->fields = array(
'FirstName' => $leadFirstName,
'LastName' => $leadLastName,
'Company' => $leadCompany,
'Email' => $leadEmail
);
//Submitting the Lead to Salesforce
$result = $connection->create(array($lead), 'Lead');
}
?>
HTML:
<h3>Sign up for an evaluation:</h3>
<span id="php_code"> </span>
<form action="https://docs.google.com/..../formResponse" method="POST" id="" target="_self" ><ol style="padding-left: 0">
<div class="ss-form-question errorbox-good">
<input type="button" name="submit" value="Contact Us" id="ss" onclick="return postToSql();"/>
....
JS:
<script type="text/javascript" src="libs/jquery-1.7.1.js" ></script>
<script type="text/javascript">
function postToSql()
{
alert('1');
alert("<?php insert(); ?>");
//return false;
}
</script>