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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.