I have a script coded, I coded it at xampp and it was working. So its at localhost working but I tried to setup this server at Ubuntu, Debian, nothing worked.
Its like that:
index.php:
switch ($_GET["page"]) {
case ("firstpage"):
include ("firstpage.php");
break;
case ("secondpage"):
print_r($_POST);
break;
index.php?page=firstpage / better said firstpage.php
<form action="index.php?page=secondpage" method="POST">
<input type="text" name="test1">
<input type="submit">
</form>
and if I do this with my virtual server (Debian 8, LAMP installed, PHP 7.1, apache2 Header modules activated) then there is a empty array.
If I do it via xampp (Mac OS X) their is then the output coming..
What is the problem? Somebody can help me via TeamViewer or something like that?
Thanks
You can try a workaround. Instead passing your number page in the url, you can send it throught a hidden button.
index.php
if(isset($_POST['page'])){
if($_POST['page'] == 'firstpage'){
include ("firstpage.php");
}elseif($_POST['page'] == 'secondpage'){
//second page
}
}else{
//$_POST['page'] is missing
}
and the form
<form action="index.php" method="POST">
<input type="text" name="test1">
<input type="hidden" name="page" value="secondpage">
<input type="submit">
</form>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.