0
After doing a search on a form
method POST
.
<form method="POST" action="../controller/precontBuscaProg.php">
<input type="date" name="dataini">
</form>
I receive on another page what was sent receiving the data so:
$dataIni = $_POST['dataini'];
$dataFim = $_POST['datafim'];
$dstPost = $_POST['dst'];
$orgPost = $_POST['org'];
$stPost = $_POST['st'];
$objProg = new Prog();
$objProg->setdataoprini($dataIni);
$objProg->setdataoprfim($dataFim);
$objProg->setdest($dstPost);
$objProg->setorig($orgPost);
$objProg->setst1($stPost);
$params= '?'.http_build_query(array('dataini'=> $dataIni, 'datafim'=>$dataFim, 'dst'=> $dstPost, 'org'=> $orgPost, 'st'=> $stPost));
header('location: ../view/programacao.php'. $params);
Returns me in the url this. Is there any way to hide this in the url ?
programacao.php?dataini=2016-08-16&datafim=2016-10-29&dst=%25%25&org=%25%25&st=1
And leave this alone ?
programacao.php
If there is another way besides . htaccess would like to know.
First if it’s generating it, it’s not doing post but get
– Otto
That, thank you I will edit the question.
– KevinF
@Otto you need to change the method="get" to method="post", in the form tag, or if it doesn’t exist you add method="post". You will also need to change the way php will receive this data
– Fabiano Cacin Pinel
@Fabianocacinpinel in my form is POST. Ai I get them so
$dataIni = $_POST['dataini'];
. After receiving send them by aheader('location: ../view/programacao.php'. $params);
to another page getting so like this in question. And I get them from ulr with a$_GET
.– KevinF
@Fabianocacinpinel if you pay attention the question is not mine, so I suppose the comment is for the owner of the post
– Otto
@Kevin. F get sends everything by post url no, follow the tip of Fabiano that will be the way you want
– Otto
@Otto, sorry, it was for Kevin.
– Fabiano Cacin Pinel
@Kevin do a post redirect search so here I found an example I don’t know if it works http://stackoverflow.com/questions/3045097/php-redirect-and-send-data-via-post . But if the goal is to hide the information you can try encryption and then decryption
– Fabiano Cacin Pinel
@Kevin another way to store them in a session and retrieve them later
– Fabiano Cacin Pinel