I need to click on a button that will download a file.
The problem is how I will indicate a filename.
Files are stored in folders tcp20100220,tcp20100220.
It depends on a date given by the user.The file in the folder will be named in the same way but will be a pdf file.(tcp20100220.pdf)
1 .A form is given to the user where he/she enters a date.Then a file is generated in the specific folder.
2. A new html page opens with a download button.
My problem:
Button is html.
The date is received into php as follow
Expand|Select|Wrap|Line Numbers
- $indate=$_POST["inputdate"];
- echo " indate is".$indate;
- //ghet input date
- if (isset($_POST["inputdate"])){
- $MyToday=date("Ymd");
- $MyToday=strtotime($indate);}
- else{
- $MyToday=$today;}
- echo"...";
Something like the following should be done
Expand|Select|Wrap|Line Numbers
- <html>
- <title>HTML with PHP</title>
- <body>
- <input type="button" value="Download Result" onClick="window.location.href='http://111.111.11.117/besa/SASoutput/tcp"<?php date('Ymd',$MyToday) ?>>/tcp"<?php date('Ymd',$MyToday) ?>>.pdf">
- </html>