Sunday, 15 September 2013

php, MySQL, fpdf and $_Get? -


I have a search form in which the user exchanged the last name

Then a There is a list of search results compared to MySQL tables and outputs (on a new PHP page).

Then, in those results, I want to be able to use a specific one, which then outputs in a PDF, use fpdf.

First page or form page code ...

  & lt; Select name = "metode" size = "1" & gt; & Lt; Option value = "lname" & gt; Last name & lt; / Option & gt; & Lt; Option value = "id" & gt; Id & lt; / Options & gt; & Lt; / Select & gt; & Lt; Input type = "text" name = "search" size = "25" & gt; & Lt; Br> Find database: & lt; Input type = "submit" value = "go !!" Name = "go" & gt; & Lt; / P & gt; // Query Details Table starts with $ query = mysql_query ("SELECT SELECT * $ $ 'as' $% search%' LIMIT 0, 50");); While ($ info = mysql_fetch_array ($ query)) {echo '& lt; A href = "pdfout.php" & gt; . $ Info ['address'] '& Lt; / A & gt; '; Echo "& lt; br & gt;"; Echo $ info ['fname']; Echo "& amp; nbsp;" Echo $ info ['lname']; Echo "& lt; br & gt;"; Echo "& lt; br & gt;"; }? & Gt; On the   

pdfout.php page, how can I remember the selected records (from the previous page) by the user?

I have tried several $ _GET statements but it can not seem to work or do you need to use sessions?

You have to pass the first parameter via pdfout. Php When you resonate database query results, you should add record identifier to href for links like this:

  echo & lt; A href = "pdfout.php? Id = '. $ Info [' your_id_field ']." "& Gt; ' $ Info ['address']. '& Lt; / a & gt;';   

Then get the code for what you're interested in. $ _ GET ['Id'] can use pdfout.php .

In the form of another note, you can actually enter mysqli Or mysql instead of PDO because it has been deprecated. Also, you need to make sure that you have $ against SQL injection Maoload and $ search have been taken from Has not made it clear whether or not, so I thought I'd mention it).

No comments:

Post a Comment