How to get values โโfrom one form to another
Can anyone help me get the values โโof two different dates when I click a button in a different form? At the moment I can only get the value of one date. These are my php scripts:
<?php
require_once 'incs/functions.php';
require_once 'classes/Database.php';
global $database;
$from_date = isset($_POST['from_date']) != "" ? $_POST['from_date']:
date('Y-m-d');
$to_date = isset($_POST['to_date']) != "" ? $_POST['to_date']: date('Y-m-
d');
$urlP = "print_one.php? uid= $from_date";
?>
Here's the code for the button:
<?php echo "<a onclick=\"return windowpop('".$urlP."', 700, 500)\" href='#'>
<button class='btn btn-round btn-white btn-size:50px;' style='alignment-
baseline:left-90px;'>Print</button></a>";
?>
As you can see, when I click the button, the "print_one.php" form only opens with the value "from_date". How can I get both the "from_date" and "to_date" values โโinto a second form known as "print_one.php" when I click the button so that I can use them to run the request.
Please, help.
source to share
As far as I know, the query string (which is contained in urlIP) is accessible via $ _GET, not $ _POST. For $ _POST, you need to submit a form. The difference would be that the values โโfrom_date and to_date would not be visible in the request string, but sent in the POST header of the HTTP request.
Also, if you choose the POST method instead of GET, your script recipient will need to redirect that HTTP POST request to another page (or else) so that when clicked in the browser, you don't get this window says, "There is some data that will be published ... ". Bottom line: POST is the preferred and correct way to transfer data from the browser to the server.
source to share