Andrew R Posted January 28, 2009 Share Posted January 28, 2009 Hi. I wrote this script to submit two forms on the one page. It works in IE and Safari but not in Firefox. Can anybody see why? The in error in Firefox is, document.myform is undefined. <? if(isset($_POST['go'])) { ////perform other functions here ?> <form name="myform" method="post" action="test.php" target="_blank"> <input name="name" type="hidden" id="name" value="<? echo $_POST['name']; ?>" /> </form> <SCRIPT language="JavaScript"> document.myform.submit(); </SCRIPT> <? } ?> <form name="contact_form" method="post" action="<? $_SERVER['PHP_SELF']; ?>"> <label> <textarea name="name" id="name"></textarea> </label> <br> <label> <input name="go" type="submit" id="go" value="Submit"> </label> </form> Any help would be much appreciated Cheers Quote Link to comment Share on other sites More sharing options...
webster08 Posted January 28, 2009 Share Posted January 28, 2009 where do i begin ..... you first need to put your document.myform.submit() in a function; then you can add your other form submit to that same function; something like: <script type="text/javascript"> function submitAll() { document.myform.submit(); setTimeout("document.contact_form.submit()", 100); } </script> you also may need to add an onsubmit="submitAll(); return false" to both of your forms. Quote Link to comment Share on other sites More sharing options...
Andrew R Posted January 28, 2009 Author Share Posted January 28, 2009 lol, I know it's a mess lol Thanks a million for you your help webster08 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.