Not sure but this may be a bug in php. Here is my dummy code.
<script language="javascript">
function fb_logout() {
document.getElementById("hidden_logout_id").value
alert(document.getElementById("hidden_logout_id").value);
document.getElementById("form_1").submit();
}
</script>
echo "<form id="form_1" action="" . $_SERVER[ PHP_SELF ] . "" method="post">";
echo "<input type="hidden" id="hidden_logout_id" name="hidden_logout_name" value="1"/>";
echo "<input type="text" id="h_logout2" name="h_logout2" value="1"/>";
echo "</form>";
var_dump($_POST);
echo "<span onclick="fb_logout();">Logout</span>";
When doing a post trough the click on the span the values of the hidden and the text inside the form do not get posted: var_dump($_POST) shows an empty variable. But it s strange that if I remove the hidden from the form (or I just place it outside the form) it works and it passes in the $_POST the value of the input text remaining in the form. Does this has to do with that the hidden is modified from an event outside the form?
感谢任何帮助。