Jump to content

Recommended Posts

Hello ,

i have a problem with form.

i want submit a form to page that appear in iframe in the same page.

and this ifram have to appear instead of the form it self.

simple example here in www.tinypic.com

when you upload the image the action page appear instead of the form.

i used this code

<html>

<script language="javascript">
function toggleFRAME(id)
{
var div = document.getElementById(id);

div.style.display = "block";
div.innerHTML="<iframe name='IFRAMENAME' src='PAGENAME.PHP'></iframe>";
}
</script>

<body>

<form method="POST" action="PAGENAME.PHP" target="IFRAMENAME">
<input type="text" name="USERINPUT" id="SOME_INPUT" value="">
<br />
<input type="submit" value="SUBMITTED" name="SUBMIT" id="THIS_IS_SUBMITTING" onclick="javascript:toggleFRAME('divID');">
</form>

<div id="divID"></div>

</body>

</html>

when i used this code the iframe appear but its appear next of the form.

that mean the form steal in the page.

any want can help me in this issue?

thank you

Link to comment
https://forums.phpfreaks.com/topic/108278-problem-with-form-submit/
Share on other sites

youre going to have to let php echo it all out...the form iframe etc.

$str = "<script language='javascript'>";

$str .= "<iframe name='IFRAMENAME' src='PAGENAME.PHP'></iframe>";

$str .= "<form method="POST" action="PAGENAME.PHP" target="IFRAMENAME">;

 

then when the page is submitted back to this page have checks to see that the form has been submitted ie use $_POST

if it has been submitted then you know that you dont want to echo the form

 

 

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.