I have a list of reports that I would like to be able to pull from a form dropdown and use PHP to generate a url to download this report.
This is the base url:
http://website/reports/report.aspx?ItemP... NAME}Tab%26amp;Export=true"%26gt;
I would like to fill in REPORT NAME from the dropdown box and print the link on the page.
How to create a form in PHP to download reports from external source?
Hmm...So the reports themselves are located at an external source, and you'd just like to print a link to that report....with a variable "report name"?
%26lt;?php
$base_url="http://www.website.com/repo...
$report=$_POST['report_name']; //From Select Box
//We concenate the value of $report to the rest of our URL
$list_url=$base_url.$report;
//Print URL
echo $list_url;
?%26gt;
%26lt;form name="form" method="post" action="#"%26gt;
%26lt;select name="report_name"%26gt;
%26lt;option value="report1.htm"%26gt;Report1%26lt;/option%26gt;
%26lt;option value="report2.htm"%26gt;Report2%26lt;/option%26gt;
%26lt;/select%26gt;
%26lt;/form%26gt;
/////////////////////
In the code above, you just set the value of your "option" tags
to whatever you'd like the variable part of the URL to be...when the PHP script parses your report_name POST variable, it will append that to the end of your base URL and print the result.
?%26gt;
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment