I have the following button which opens a new tab/window and redirecting to test.php page. I wanted to post the data of $a to test.php
<input type="button" onclick="window.open('test.php?var=<?php echo $a;?>','_blank');" value="test"/>
test.php
$b = $_GET['var'];
$_GET
in the above case will be able to retrieve the data posted from the url query, however if I change it to $b = $_POST['var'];
I get undefined index error for var.
I read from other posts that I should not use GET for submission of sensitive data. So my question is: How can I modify the code such that I can post the data of variable var
to test.php using $_POST
?