|
Hi,
I am trying to write a webpage that submits a form to a php file.
It does this in 2 ways, once when the submit button is pressed, and once after a timeout.
I can get the submit button to work and submit the details correctly, however when I post it through
the javascript, document.form.submit I get errors. The first of these error was because I had the form input (to submit the form) called 'submit'.
I changed this, and altough the javascript now executed it didn't update the php correctly. Not only that but the submit button no longer worked.
Is there a way of posting a form in javascript without using the submit function, or is there a way to simulate the user pressing on the submit button. Or something that I'm doing totally wrong!
It looks to me like the php file (which I didn't write or understand) doesn't like it when it isn't sent the value submit. I could be wrong about this though.
Any ideas? (Code below, cut down version)
Thanks,
Gavin
NOTE: I haven't put the timeout code here (and I have put dummy values in), I just the javascript call in the onload funtion for ease of reading.
<HTML>
<HEAD>
<script language="JavaScript">
function submitForm()
{
document.form["name"].value="ee";
document.form["score"].value="15";
document.form.submit();
}
</script>
</head>
<body onload="return submitForm()">
<form name ="form" action="***removed***" enctype="multipart/form-data" method="post">
<input type="text" class="post" name="name" value="" />
<input type="text" class="post" name="score" value="" />
<!-- Line below is not liked by the javascript but has to be there for the php! -->
<input type="submit" name="submit" value="Submit" class="mainoption" />
</BODY>
</HTML>
|
|
|
|
|
|
|
// |