Custom Files with own html form (v2020)

Hi,let me submit you an issue i’m not able to bypass in PHP Maker 2020.I generate a very simple custom file (TestMain.php) in customphp (including common files) which has a simple content : include_once a new php file with my form (method POST).Then when i process the form i’d like to go back to the input form (e.g. what has been input is wrong or deserves adjustment) and i invoke the include “TestMain.php”
I expect to receive again my form, but what happens is an error message : Request POST not validFrankly i don’t know how to bypass the problemdo you have some suggestion to give meThanks in advance
giorgio

Please post your code in that Custom File for more discussion.

OK thanks, my code as matter of sample is :

  • The Custom file generated is:


namespace PHPMaker2020\GSD4020201019;

// Session
if (session_status() !== PHP_SESSION_ACTIVE)
	session_start(); // Init session data

// Output buffering
ob_start();
?>
<?php
$RELATIVE_PATH = "../";
?>
<?php include_once $RELATIVE_PATH . "autoload.php"; ?>
<?php

// Write header
WriteHeader(FALSE);

// Create page object
$TestMain = new TestMain();

// Run the page
$TestMain->run();

// Setup login status
SetupLoginStatus();
SetClientVar("login", LoginStatus());

// Global Page Rendering event (in userfn*.php)
Page_Rendering();
?>
<?php include_once $RELATIVE_PATH . "header.php"; ?>
<?php
include_once "TestSwitch.php";

?>

<?php if (Config("DEBUG")) echo GetDebugMessage(); ?>
<?php include_once $RELATIVE_PATH . "footer.php"; ?>
<?php
$TestMain->terminate();
[/code]

- the TestSwitch.php is :

[code]
<script language="javascript">	

$(document).ready(function() {
    $('#GiorgioModal1').modal({
    backdrop: true
    })
});
</script>


<html>
<body>
<div id="GiorgioModal1" class="modal fade">
<div class="modal-dialog modal-lg table-extra">
<div class="modal-content">
<div class="modal-header">

</div>
<div class="modal-body">
<form id="myform" class ="form-horizontal" action="Test.php" method="post">

<div class="tab-content">
<div class="tab-pane active" id="uno">

<div class="form-group row">
<label class="col-sm-3 col-lg-3 control-label">Codice Personale </label>
<label class="col-sm-5 col-lg-5 control-label">
<input type="text" id="codice" value="" name="codice" class="form-control">
</label>
</div>
<br>
<br>
<div class="form-group row">
<label class="col-sm-3 col-lg-3 control-label">Next action</label>
<label class="col-sm-5 col-lg-5 control-label">
<input type="text" id="next" value="" name="next" class="form-control">
</label>
</div>

</div>

</div>

<div class="modal-footer">
<input class="btn btn-primary ewButton" type="submit" value="Prosegui" >

</form>
<form id="" action="../logout.php" method="get"> 
<input class="btn btn-secondary" type="submit" value="Chiudi" >
</form>
</div>
</div>
</div>
</div>

</body>
</html>
[/code]

- The Test.php is :

[code]
<?php

$codice=$_POST['codice'];
$next=$_POST['next'];

if ($codice == "") {
  include_once "TestMain.php";
} elseif ($next=="") {
  include_once "TestMain.php";
} 
          
?>

as you can see i always go back to the TestMain.php (of course this is just a sample) but i receive
Request POST not validThanks again for your answergiorgio

Try with get instead of post method if you want to go back to the same Custom File.Perhaps this following post would help if you want after submitting the form in Custom File, then it will go back to itself:https://discourse.hkvstore.com/t/404-error-route-index-php-not-found/3649/2

It works now !!!Thanks very much
giorgio