javascript problem?

<script language="Javascript">

function submitForm(action)

{

document.all.formlogin. innerHTML = document.all.formlogin.innerHTML +

"<input type=hidden name=statusx value=" + action + ">";

document.formlogin. submit();

}

</script>

<form name = "formlogin" action = "index.php" method = "POST">

UserName: <input type = "text" name = "UserName"></br></br>

PassWord: <input type = "password" name = "PassWord"></br></br>

<a class = "login" href="javascript: submitForm(\'temp\');"> Temporary Login</a></br>

<a class = "login" href="javascript: submitForm(\'perm\');"> Permanent Login</a>

</form>

I made such code, but once I click any of login links, my $_POST array has only statusx value, but not UserName and PassWord. What should I change?

By the way, yahoo forces me to add some spaces for the code to be well seen

4 Answers

Relevance
  • 1 decade ago
    Favorite Answer

    Hi my friend, you should try this

    <script language="Javascript">

    function submitForm(action)

    {

    st=document.getElementById('statusx');

    st.value=action;

    document.formlogin.submit();

    }

    </script>

    <form name = "formlogin" method = "POST">

    UserName: <input type = "text" name = "UserName"></br></br>

    PassWord: <input type = "password" name = "PassWord"></br></br>

    <input type=hidden name=statusx id=statusx>

    <a class = "login" href="javascript: submitForm('temp');"> Temporary Login</a></br>

    <a class = "login" href="javascript: submitForm('perm');"> Permanent Login</a>

    </form>

  • 1 decade ago

    Try using this

    in <head>

    <script language="Javascript">

    function submitForm(action)

    {

    document.all.formlogin.innerHTML += "<input type=hidden name=statusx value=" + action + ">";

    document.formlogin. submit();

    }

    </script>

    in <body>

    <form name="formlogin" action="target.php" method="POST">

    UserName: <input type="text" name="UserName"></br></br>

    PassWord: <input type="password" name="PassWord"></br></br>

    <a class = "login" href="javascript: submitForm('temp');"> Temporary Login</a></br>

    <a class = "login" href="javascript: submitForm('perm');"> Permanent Login</a>

    </form>

    i have tested on my end its working fine

  • 4 years ago

    regrettably, i do no longer think there is any organic Javascript/HTML answer for this. Javascript in simple terms does now no longer have the energy to test for all the information interior the internet itemizing in any efficient approach. some thing else needs to be performed to be certain that the server to facilitate that.

  • 1 decade ago

    email me it

    delta_bravo_1kilo@yahoo.ca

Still have questions? Get your answers by asking now.