This is my situation: I have a directory listing script that lists through directories with backups. Each file (backup) has link labeled "restore" which trigger a javascript function submitPostLink() and that function trigger another script which restore selected backup. The important part of a code is: <script language=javascript type=text/javascript> function submitPostLink(file) { if(confirm("Do you really want to restore backup "+ file +"?")) { document.postlink['backup'].value = file; document.postlink.submit(); } } </script> <form action="index.php" name=postlink method="post"> <input type="hidden" name="backup" value=""> <a href=# onclick="submitPostLink('<?php echo $files[$i] ?>');">restore</a> Code (text): $file[$i] is a variable with a current name of a file. I need that to POST it not to GET it and it has to be a hyperlink not a button or something like that. That's why I'm using a javascript, to submit that form. When I'm listing a directory with only one backup and I click on restore hyperlink, it works well, but when there are more than one backup, the javascript function is called with a right variable (I know that because 'confirm("Do you really want to restore backup "+ file +"?"))' has a right variable file) but will not submit that form. Could you help me sort it out, please?
Is postlink part of the Javascript api or are you using a library like jquery? Anyway my suspicion is that you need to call postlink on the form not the document. $('form_id').postlink
How are you coding the loop? Maybe there is a problem with the "a tag" in the loop. But if you can "alert" the right file name then... With a button does it work?
I forgot to write that this problem is already SOLVED. Sorry for this, I wrote it at three forums. It was the problem with the loop.