echo '
<body onload="document.subfrm.submit()">
<form method=post action="index.php?" name="subfrm">
<input type=hidden name="mnux" value="master.dosen">
<input type=hidden name="gos" value="DsnEdt">
<input type=hidden name="md" value="0">
<input type=hidden name="dsnid" value="'.$dsncr.'">
</form>
</body>
<noscript><meta http-equiv="refresh" content="0; url=JavascriptHarusDinyalakan.html" /></noscript>
<noscript><p>Please enable JavaScript in your browser for better use of the website.</p></noscript>
';
я попробовал оба метода здесь http://form.guide/php-form/php-form-submit.html
но ни один из них не перенаправлен на новую страницу
<?php
if(isset($_POST['submit']))
{
function do_post_request($url, $data, $optional_headers = null)
{
$params = array('http' => array(
'method' => 'POST',
'content' => $data
));
if($optional_headers != null)
{
$params['http']['header'] = $optional_headers;
}
$ctx = stream_context_create($params);
$fp = @fopen($url, 'rb', false, $ctx);
if (!$fp)
{
throw new Exception("Problem with $url, $php_errormsg");
}
$response='';
while (!feof($fp))
{
$response = $response.fgets($fp);
}
if ($response === false)
{
throw new Exception("Problem reading data from $url, $php_errormsg");
}
fclose($fp);
return $response;
}
$host = 'http://mydomain.in';
$url = 'http://mydomain.in/formHandler.php';
$username = 'admin';
$password = '123456';
$data = array ('action' => 'login','lgname' => $username, 'lgpassword' => $password, 'format' => 'txt');
$data = http_build_query($data);
$reply = do_post_request($url, $data);
echo "**********Response*********<pre>";
echo var_dump($reply);
#header('location:'.$host);
#exit;
}
else {
echo '<form method="post" enctype="multipart/form-data" action="'.$_SERVER['PHP_SELF'].'"><input type="text" name="uname" /><br><input type="password" name="password" /><input type="submit" name="submit"></form>';
}
?>
Других решений пока нет …