[英]PHP header redirect is reloading the same part on the HTML page as opposed to another part on the HTML page using ids
I'm making a website that involves PHP redirects, but when I redirect with the header function it doesn't redirect to the right id it just redirects to the page without the id. 我正在制作一个涉及PHP重定向的网站,但是当我使用标头函数重定向时,它不会重定向到正确的ID,它只会重定向到没有ID的页面。
It is supposed to redirect to: 它应该重定向到:
header('Location: '.$findHttp.'://'.$_SERVER["HTTP_HOST"].'/~a7068104/2013-2014/Lab_13/Reports/Reports.php#redirect');
But it actually redirects to: 但实际上它重定向到:
header('Location: '.$findHttp.'://'.$_SERVER["HTTP_HOST"].'/~a7068104/2013-2014/Lab_13/Reports/Reports.php');
Can you please tell me why that is? 你能告诉我为什么吗?
Here is the full PHP code: 这是完整的PHP代码:
<?php
if (isset($_POST['reportsubmit'])) {
$radio = $_POST['customer'];
if ($radio == 'customer') {
$redirect = 'Click <a href="#customer">here</a> to continue on with the form';
} else if ($radio == 'item') {
$redirect = 'Click <a href="#item">here</a> to continue on with the form';
} else if ($radio == 'department') {
$redirect = 'Click <a href="#department">here</a> to continue on with the form';
} else if ($radio == 'person') {
$redirect = 'Click <a href="#person">here</a> to continue on with the form';
}
$findHttp = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http';
header('Location: '.$findHttp.'://'.$_SERVER["HTTP_HOST"].'/~a7068104/2013-2014/Lab_13/Reports/Reports.php#redirect');
exit;
} else if (isset($_POST['customersubmit'])) {
//process form
//redirect
exit;
} else if (isset($_POST['itemsubmit'])) {
//process form
//redirect
exit;
} else if (isset($_POST['departmentsubmit'])) {
//process form
//redirect
exit;
} else if (isset($_POST['personsubmit'])) {
//process form
//redirect
exit;
}
?>
is it possible to work with GET function? 可以使用GET功能吗? Like that.
像那样。
header('Location: http://'.$_SERVER["HTTP_HOST"].'/~a7068104/2013-2014/Lab_13/Reports/Reports.php?id=redirect');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.