问题描述:

I have a number of php pages that create pdfs based on data passed to them in the URL such as:

http://www.website.co.uk/reporting/makeIssuePDF.php?officeName=surrey&issueID=23

Is there any way of hiding the detail in the address bar so that all the user sees is:

http://www.website.co.uk

网友答案:

To avoid the user seeing the the data in the URL you will need the data 'posted' to the script. How this is done depends on what has the data in the first place.

if its a form you change <form method="get" action="makeIssuePDF.php"> to <form method="post" action="makeIssuePDF.php">

if its send via an ajax query then again the ajax query would need to post the data to makeIssuePDF.php. There are other ways but you should be able to find out how the data is sent currently.

then inside makeIssuePDF.php you will need to get the post data like this:

$officeName = $_POST['officeName'];
$issueID = $_POST['issueID'];
网友答案:

Yes. You could have a form:

<form action="makeIssuePDF.php" method="POST">
<input type="hidden" name="officeName" value="surrey"/>
<input type="text" name="issueID" value=23"/>
<input type="submit" value="Go"/>
</form>

In makeIssuePDF.php, replace $_GET['officeName'] with $_POST['officeName']. Do same thing with the $_GET['issueID'].

相关阅读:
Top