Module Rules-> PHP Code, trying to use a Form Handler from Pardot, but Pardot is not receiving the info I am trying to use the Rules module to send a form-handler to Pardot using a PHP script when a user logs in. I tested my variables to make sure they were valid by seeing them in a message and they appear fine. The problem I am having is that Pardot does not seem to be getting the form. 

The Rules module information


Event: 'User Logs in'
Condition: none
Action: Execute custom PHP Code.


Pardot given form handler link

(similar to)

&lt;form action="http://go.pardot.com/5/38543/2014-03-31/xyz" method="post"&gt;

Pardot has a link explaining that I could use an IFRAME instead a Form Action to POST.

Custom PHP Code:

$name = [account:mail];
$FName = [account:profile-user:field-profile-last-name];
$LName = [account:profile-user:field-profile-last-name];
echo '&lt;iframe src="http://go.pardot.com/5/38543/2014-03-31/xyz?name='.$name.'&amp;FName='.$FName.'" width="1" height="1"&gt;&lt;/iframe&gt;';


Any help?
It seems the reason why was, that the Iframe was loading and then the page would redirect to wherever the onSuccess page would be set as. So this worked instead. 

1- Created a module that hooked the user_login(&amp;$edit,$account) function.

Within the function I defined my variables needed for the form handler, (this example will be email, first name and last name). In my case the First name and Last name were found in the Profile page so I had to get the Profile Id to find them. 

$uid = $account-&gt;uid;
$mail = $account-&gt;mail;
$Fname;
$Lname;
$pid = db_query('SELECT pid FROM {profile} WHERE uid = :uid', array(':uid' =&gt; $uid))-&gt;fetchField();
$Fname= db_query('SELECT field_profile_first_name_value FROM {field_data_field_profile_first_name} WHERE entity_type = \'profile2\' and entity_id = :pid', array(':pid'=&gt; $pid))-&gt;fetchField();
$Lname= db_query('SELECT field_profile_last_name_value FROM {field_data_field_profile_last_name} WHERE entity_type = \'profile2\' and entity_id = :pid', array(':pid'=&gt; $pid))-&gt;fetchField();


2- After I used the user_cookie_save(array()) function so I can send the info to the IFRAME after the page loads. (this is still in the user_login function)

user_cookie_save(
      array(
        'pardotParams' =&gt; '?Email='.$mail.'&amp;FName='.$Fname.'&amp;LName='.$Lname.'&amp;RequestUpgrade='.$RequestUpgrade.'&amp;Serial='.$Serial.'&amp;Industry='
        .$Industry.'&amp;Country='.$Country.'&amp;USFedOrg='.$USFedOrg.'&amp;State='.$State.'&amp;Company='.$Company.'&amp;Phone='.$Phone ,
        'pardotUrl' =&gt; $url
      )
    );


3- Lastly, I added this bit of code in the page.tpl.php file found in my template. This will create the iframe off screen but still give it time to load. 

&lt;?php 

  // Comparing the login time to the current timestamp to see if the user just logged in
  if (property_exists($GLOBALS['user'], 'login') 
      &amp;&amp; (time() - $GLOBALS['user']-&gt;login) &lt; 5 ) {
    // Show the ParDot hidden iFrame. Added some css positioning to move the iframe off the screen
    // as it was throwing off the page alignment regardless of where it was shown in the template.
    echo('&lt;iframe src="http://go.pardot.com/l/38912/2014-03-31/cz7' . 
     $_COOKIE['Drupal_visitor_pardotParams'] . 
     '" width="1" height="1" style="position: absolute; top: -999px; left: -999px;"&gt;&lt;/iframe&gt;');
  }
?&gt;