Jump to content

pass value of seach form to another mpdf.


aquilina

Recommended Posts

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?

Link to comment
Share on other sites

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 by cyberRobot
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

 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.

Link to comment
Share on other sites

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 by aquilina
Link to comment
Share on other sites

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 by aquilina
Link to comment
Share on other sites

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.  :happy-04:
 
The print_tax.php page could then use the corresponding $_GET variables to pull whatever information is necessary for mpdf.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.