aquilina Posted October 18, 2016 Share Posted October 18, 2016 I got a page where user able to search data by filtering using datepicker(date range) or using dropdown selection option. There are two button on the page which are search button and print button. I want to pass the data which i have search to another page where i using mpdf. How to pass the searched value to another page(mpdf).. im using method POST for my form. what kind of unique ID or value that i can pass to another page? Quote Link to comment Share on other sites More sharing options...
cyberRobot Posted October 18, 2016 Share Posted October 18, 2016 (edited) So basically, you have a form that submits to another page for processing. Now you want to pass the values used in the processing script to another script that uses mpdf. Is that correct? If so, how does the visitor get to the mpdf script page? Do they click a link? Are you using a header redirect? Do you have another form? Edited October 18, 2016 by cyberRobot Quote Link to comment Share on other sites More sharing options...
aquilina Posted October 19, 2016 Author Share Posted October 19, 2016 So basically, you have a form that submits to another page for processing. Now you want to pass the values used in the processing script to another script that uses mpdf. Is that correct? If so, how does the visitor get to the mpdf script page? Do they click a link? Are you using a header redirect? Do you have another form? For that form, i does not using any another page for processing because i display the result in the same page. once the result search is found, i want the pass the value of the search result to MPDF by clicking the print button and it will bring to mpdf page where the report templete is appear... im not really familiar with mpdf.btw how to get the value from another page form. Quote Link to comment Share on other sites More sharing options...
cyberRobot Posted October 19, 2016 Share Posted October 19, 2016 Are you using an HTML form for the print button? If so, pass the data using hidden input fields. Then you can retrieve the data using $_POST or $_GET, depending on what your form's method attribute is set to. Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted October 19, 2016 Share Posted October 19, 2016 im not really familiar with mpdf you would start by going through the examples in the documentation. mpdf expects you to either capture the html you want to convert or to add each line of html as you are producing it. the easiest way of coding this would be to do it on the page where you are producing the html output, so that you don't need to duplicate the code that's responsible for searching the database and producing the html. you would also want to do it completely on the server-side, since accepting the html input from the browser would leave the application open to inserting 'any' content into the pdf document, not just the output from your report code. Quote Link to comment Share on other sites More sharing options...
aquilina Posted October 20, 2016 Author Share Posted October 20, 2016 (edited) you would start by going through the examples in the documentation. mpdf expects you to either capture the html you want to convert or to add each line of html as you are producing it. the easiest way of coding this would be to do it on the page where you are producing the html output, so that you don't need to duplicate the code that's responsible for searching the database and producing the html. you would also want to do it completely on the server-side, since accepting the html input from the browser would leave the application open to inserting 'any' content into the pdf document, not just the output from your report code. Im currenlty working on it. in searchform.php i got two type of searching method by using dropdown option (search based on company name) and using date range(search company based on the date range) i able to pass the dropdown option (search based on company) result search to print report page (mpdf).. in my searchform.php my print button <a href="print_tax.php?company=<?php echo $company; ?> while for my print.php $company = $_GET['company']; . I was able to pass the dropdown searched data. But i wonder how i going to pass the value when i using date range search to print .php? $from = $_POST["from"]; $to = $_POST["to"]; what should i put in the print button to pass the value to the print.php? Edited October 20, 2016 by aquilina Quote Link to comment Share on other sites More sharing options...
aquilina Posted October 20, 2016 Author Share Posted October 20, 2016 (edited) Are you using an HTML form for the print button? If so, pass the data using hidden input fields. Then you can retrieve the data using $_POST or $_GET, depending on what your form's method attribute is set to. yes i using HTMl form for the print button.. in my searchform.php got two type of search filter, dropdown option (search based on company name )and date range. (search based on date range).. both of it i using $_POST $companyname = $_POST['companyname'] << this for dropdown while for the date range $from = $_POST['from'] $to = $_POST['to'] is there any specific value need to put in the print button so that it able to pass the value when i using dropdown or date search? for my print button i put <a href="print_tax.php?company=<?php echo $COMPANYNAME; ?> IN print.php i only able to get $company = $_GET['company'];.. so how about if i search using date filter? Edited October 20, 2016 by aquilina Quote Link to comment Share on other sites More sharing options...
cyberRobot Posted October 24, 2016 Share Posted October 24, 2016 But i wonder how i going to pass the value when i using date range search to print .php? $from = $_POST["from"]; $to = $_POST["to"]; what should i put in the print button to pass the value to the print.php? Have you tried something like this: if (searching by company name) <a href="print_tax.php?company=<?php echo $companyname; ?>">Print</a> elseif (searching by date range) <a href="print_tax.php?from=<?php echo $from; ?>&to=<?php echo $to; ?>">Print</a> Note: the above contains pseudo code. The print_tax.php page could then use the corresponding $_GET variables to pull whatever information is necessary for mpdf. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.