Jump to content

submit a form inside iframe(invisible) automatically


chandra prabha

Recommended Posts

in login.php

 

<iframe name="foo" id="foo" src="flowerpodLogin.php" frameborder="0" style="display:none" >

 

</iframe>

 

in flowerpodLogin.php

 

<form name="frmID" id="frmID" method="post" target ="foo" action="path?act=Login&CODE=01">

<input type="hidden" name="UserName" value="nivethak" />

<input type="hidden" name="PassWord" value="test123" />

<input type="hidden" name="submit" value="Log me in" />

<input name="referer" type="hidden" value="path/index.php?" />

<input type="hidden" name="CookieDate" value="1" />

<input type="hidden" name="pass_hash" value="0" />

<input type="hidden" name="member_id" value="0" />

<input type="hidden" name="anonlogin" value="-1" />

<!-- <input type="hidden" name="session_id" value="daec59931c7098785e65aaf748286a3d" />

 

<input type="hidden" name="ipb_stronghold" value="5e8785478cd79872a36cda22a2636b31" /> -->

<input type="hidden" name="coppa" value="0" />

 

 

<input type="submit" name="flowerpodSubmit" id="flowerpodSubmit" />

 

</form>

 

<script language="javascript">

// document.parent.frmID.submit(); - throws document.parent is undefined

//document.frmID.submit();--throws submit() is not function error

//document.getElementById("foo").frmID.submit() - throw document.getElementById("foo") is null

</script>

 

Now i want to submit the form automatically. the code in js shows error.

You can try this:

 

login.php

<iframe name="foo" id="foo" src="flowerpodLogin.php" frameborder="0" style="display:none">
</iframe>

 

 

flowerpodLogin.php

<html>
<head>
<script language="javascript">
function SubmitForm()
{
document.getElementById('foo').submit();
}
</script>
</head>
<body onload="SubmitForm()">

<form name="frmID" id="frmID" method="post" target ="foo" action="path?act=Login&CODE=01">
<input type="hidden" name="UserName" value="nivethak" />
<input type="hidden" name="PassWord" value="test123" />
<input type="hidden" name="submit" value="Log me in" />
<input name="referer" type="hidden" value="path/index.php?" />
<input type="hidden" name="CookieDate" value="1" />
<input type="hidden" name="pass_hash" value="0" />
<input type="hidden" name="member_id" value="0" />
<input type="hidden" name="anonlogin" value="-1" />
<!-- <input type="hidden" name="session_id" value="daec59931c7098785e65aaf748286a3d" />

<input type="hidden" name="ipb_stronghold" value="5e8785478cd79872a36cda22a2636b31" /> -->
<input type="hidden" name="coppa" value="0" />
<input type="submit" name="flowerpodSubmit" id="flowerpodSubmit" />
</form>

 

That should help you out.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.