For some reason when I use this script in a HTML file (aptly named "test.html"):
It works. However, when I move it from testing to actually putting it to use in a PHP file like so (this would be in, for example, form.php, but in the url it'd be of the form: form.php?confirmed=yes&var=meh&var2=bleh)...HTML Code:<form action="test.php" name="testForm" id="testForm" method="post"> Blarg!! <script type="text/javascript" language="javascript"> function formSubmit() { document.forms["testForm"].submit(); } setTimeout('formSubmit()', 120000); </script> </form>
It does not. The echo statement related to the <script></script> tags output the exact same code as is put in the test.html file... but it won't auto-submit... It just sits there and waits for you to click on the "Submit" button yourself. Any thoughts on this, guys?PHP Code:<?php
// Create the <form> HTML tag and have it set to submit to the very same file under the same variable conditions
// There is a function ready to process form data once the submit button has been pressed/the form has been auto-submitted
// via use of the $_POST['form_element'] variables.
echo "<form action=\"form.php?confirmed=yes&var=" . $_GET['var'] . "&var2=" . $_GET['var2'] . "\" method=\"post\" name=\"testForm\" id=\"testForm\">\n\n";
/* ... */ # <-- Whole bunch of PHP code creating form elements
// Create the <script></script> tags that will auto-submit the form after two minutes.
echo "<script type=\"text/javascript\" language=\"javascript\">\nfunction formSubmit() {\n document.forms[\"testForm\"].submit();\n}\nsetTimeout('formSubmit()', 120000);\n</script>\n\n<input type=\"submit\" name=\"submit\" value=\"Submit Form\" />\n\n</form>";
?>
.


LinkBack URL
About LinkBacks
Reply With Quote
Haha







