AnsweredAssumed Answered

How do I have one form save two leads

Question asked by 82221 on Mar 4, 2015
Latest reply on Jan 30, 2016 by Sanford Whiteman
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

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.

$url = '';
$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);
<form id="theform" action="" method="POST">
<input type="hidden" name="munchkinId" value="munchkinId#">
<input type="hidden" name="formid" value="forimd#">
First Name:
<input type="text" name="FirstName">
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>