I have a form with fields like name, email, zipcode, guest name, guest email, guest zipcode. How would I get the "guest" fields to save as a separate lead?
I was directed to http://developers.marketo.com/blog/server-side-form-post/
And this is what I have so far. Would cURL be the best way to do this? and how do I save as 2 leads does marketo have a way of doing this or would I need to write an SQL statement.
<?php
extract($_POST);
$url = 'http://app-x.marketo.com/index.php/leadCapture/save';
$fields = array(
'FirstName' => urlencode($first_name),
'LastName' => urlencode($last_name),
'Email' => urlencode($email),
'PostalCode' => urlencode($postalcode),
'Guest_Last_Name' => urlencode($guest_last_name),
'Guest_Name' => urlencode($guest_first_name),
'Guest_Email_Address' => urlencode($guest_email),
);
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string, '&');
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
$result = curl_exec($ch);
curl_close($ch);
?>
<form id="theform" action="http://app-x.marketo.com/index.php/leadCapture/save" method="POST">
<input type="hidden" name="munchkinId" value="munchkinId#">
<input type="hidden" name="formid" value="forimd#">
First Name:
<input type="text" name="FirstName">
<br>
Last Name:
<input type="text" name="LastName"><br>
Email Address:
<input type="text" name="Email"><br>
Zip Code:
<input type="text" name="PostalCode"><br>
Colleague First Name:
<input type="text" name="Guest_Last_Name"><br>
Colleague Last Name:
<input type="text" name="Guest_Name"><br>
Colleague Email:
<input type="text" name="Guest_Email_Address"><br>
</form>