I've read a lot of googling forums, but my simple sample still doesn't work. That is why I ask you to help me with my prob. I have page1 and page 2. I also have for debugging button (submit) in page1 and page2 with function header($direct). This part works and I have full understanding. But I cann't call full postback via javascript function. I don't know where is my fault. This is my union code for page1:
<?php
if (isset($_POST['btn']))
{
header('Location: page2.php');
}
elseif (isset ($_POST['btn2']))
{
header('Location: page2.php');
}
?>
<h1>This is page 1</h1>
<form id="form1" name="form1" method="post" action="<?php $_SERVER['PHP_SELF'] ?>">
<input type="submit" name="btn" value="submit: goto page2"/>
<input type="button" name="btn2" id ="btn2" value="button: goto page2" onclick="postback();" />
</form>
<script type="text/javascript">
function postback(){
var f = document.getElementById('form1');
f.submit();
}
</script>
I want to call full postback without ajax because with ajax I have no problems.
In last example I tried to call javascript postback with selection object and I couldn't any problems with it. But now, when I try to use simple button onclick event it still doesn't work. why? I hope you understand my English and point me to my faults. Thank you in advance