0

I would like to use an anchor instead of a button

The Button works as either a button or Submit, but the Anchor does not.

<form id="contact" action="includes/login.php" method="post" name="login_form">     
<input type="submit" value="Login" onclick="formhash(this.form, this.form.password);"/> 



<a href="includes/login.php" onclcik="return formhash(this.form, this.form.password);"><strong>Login</strong></a>

I'm sure its to do with passed/posted parameters but not sure how to fix it.

1 Answer 1

2

Try this:

<a onclick="document.getElementById('contact').submit();">click here</a>

This will post all the content of the form.

5
  • should post, but no function executed.
    – Will
    Jul 24, 2014 at 4:15
  • which function you want to execute Jul 24, 2014 at 4:48
  • the input button has an onclick of formhash() which needs to be executed and passed.
    – Will
    Jul 24, 2014 at 12:13
  • can you upload your script Jul 24, 2014 at 12:23
  • function formhash(form, password) { // Create a new element input, this will be our hashed password field. var p = document.createElement("input"); // Add the new element to our form. form.appendChild(p); p.name = "p"; p.type = "hidden"; p.value = hex_sha512(password.value); // Make sure the plaintext password doesn't get sent. password.value = ""; // Finally submit the form. form.submit();
    – Will
    Jul 24, 2014 at 13:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.