i'm having problems accessing the variables submitted by a form using javascript...

here's my test code...

<html>
<body>
<?php print_r($_POST); ?>
<form method='POST' action=''  name="vform">
<label for='description'>Class Name</label><input type='text' name='description'  >
</form>
<a href='' class='text' onclick='document.vform.submit()'>---Post this form---</a>
</body>
</html>

the form will submit when the link is clicked but the $_POST variable always comes back as an empty array...

can anyone shed some light on what's going on?

    That's because the request you're making is the one caused by the <a> tag's own behaviour. Try href='#'.

      nope still no difference... it's strange - this one has me baffled, i guess the important thing is that it works on my webserver, but it would be nice to know why it doesn't on my local box

      note: submitting using a submit button, or by pressing enter works as desired, but just not by javascript submit()

        Well it certainly isn't a PHP problem, since the server is receiving a GET request as per normal <a> tag behaviour, and not a POST request. Something must be up with your Javascript.

          Write a Reply...