Submitting form automatically

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • atlkhan
    New Member
    • Apr 2007
    • 39

    Submitting form automatically

    Hi

    I am trying to submit the form automatically without button, but its not working. Following is the code

    [code=html]
    <?php


    $name="Myname";


    <form name="MyForm" action="/cgi-bin/matweb.exe" method="POST">
    <input type="hidden" name="mlmfile" value="test">
    <input type="hidden" name="name" value=" <?PHP echo $name ?>" >
    <p><input type="submit" name="Submit" value="Execute" ></p>

    </form>

    <script type="text/javascript" language="JavaS cript"><!--

    document.MyForm .ThisPageURL.va lue = document.URL;

    var x = new Date();

    document.MyForm .TimeZoneOffset .value = x.getTimezoneOf fset();

    document.MyForm .submit();

    //--></script>

    ?>[/code]

    [Please use CODE tags when posting source code. Thanks! --pbmods]
  • bucabay
    New Member
    • Apr 2007
    • 18

    #2
    Originally posted by atlkhan
    Hi

    I am trying to submit the form automatically without button, but its not working. Following is the code


    <?php


    $name="Myname";


    <form name="MyForm" action="/cgi-bin/matweb.exe" method="POST">
    <input type="hidden" name="mlmfile" value="test">
    <input type="hidden" name="name" value=" <?PHP echo $name ?>" >
    <p><input type="submit" name="Submit" value="Execute" ></p>

    </form>

    <script type="text/javascript" language="JavaS cript"><!--

    document.MyForm .ThisPageURL.va lue = document.URL;

    var x = new Date();

    document.MyForm .TimeZoneOffset .value = x.getTimezoneOf fset();

    document.MyForm .submit();

    //--></script>

    ?>
    You've named one of your form fields "submit".
    [HTML]
    <input type="submit" name="Submit" value="Execute" >[/HTML]

    That overwrites the submit() method of the form. Name it something else so that you can still use the submit() method.

    Comment

    Working...