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:

require_once 'incs/functions.php';
require_once 'classes/Database.php';

global $database;

$from_date = isset($_POST['from_date']) != "" ? $_POST['from_date']:       
$to_date   = isset($_POST['to_date']) != "" ? $_POST['to_date']: date('Y-m-  

$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- 


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

2 answers

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.



You can pass two variables in the url

$urlP = "print_one.php?uid=$from_date&uid2=$to_date";




All Articles