SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Member
    Join Date
    Jun 2012
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up Help Please! PHP CODE data from mysql to PDF output to print

    i want to create a C.O.R(Certifiate of registartion) and class schedule into PDF format to print by the student..but i dont have idea.. my problem is how to get the data where insert by the student in the register form then come out in pdf to print serve as their C.O.R. ...all information that they insert into the register form will need to come out in pdf. i dont know how to start this coding. using PHP language..

  2. #2
    SitePoint Addict
    Join Date
    Apr 2011
    Posts
    265
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Hi,
    You can get those data (from form with $_POST['field_name'] , or from mysql table with SELECT), then creade in php a html document wirh those data , and use "dompdf class" to convert html to pdf.
    dompdf is free on the net.
    Free: Web Programming Courses HTML, CSS, Flash
    Web Programming: AJAX Course and PHP-MySQL Course video Lessons
    Good JavaScript and jQuery course for beginners

  3. #3
    SitePoint Mentor silver trophy
    Rubble's Avatar
    Join Date
    Dec 2005
    Location
    Cambridge, England
    Posts
    2,435
    Mentioned
    82 Post(s)
    Tagged
    3 Thread(s)
    This will create a pdf but might be a bit to complicated for you to start out with: http://www.fpdf.org/
    Why does the output need to be a pdf?

  4. #4
    SitePoint Member
    Join Date
    Jun 2012
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    for a student purpose.. for a online enrollment system ..

  5. #5
    SitePoint Member
    Join Date
    Jun 2012
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    can u help me?

  6. #6
    SitePoint Member
    Join Date
    Jun 2012
    Location
    Iligan City, Philippines
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    First, you need to query the student first

    $sql = "SELECT * FROM `student_tbl` WHERE student_id=$id and school_year=$sy and term=$term";

    Then try to use either of this library:
    http://www.tcpdf.org/docs.php
    http://www.fpdf.org/

    But if I were you, use the fpdf because it is much simpler and easy to use.

  7. #7
    SitePoint Member
    Join Date
    Jun 2012
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thnx alot

  8. #8
    SitePoint Member
    Join Date
    Jun 2012
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    mysql_connect('localhost','root','');
    mysql_select_db('db_enrollment');

    <?php
    require('fpdf.php');

    class PDF extends FPDF
    {
    // Page header
    function Header()
    {
    // Logo
    $this->Image('logo.jpg',22,10,160);
    // Arial bold 15
    $this->SetFont('Arial','B',15);
    // Move to the right
    $this->Cell(80);

    // Line break
    $this->Ln(20);


    }

    $result=mysql_query('select * from student');




    // Page footer
    function Footer()
    {
    // Position at 1.5 cm from bottom
    $this->SetY(-15);
    // Arial italic 8
    $this->SetFont('Arial','I',8);

    }
    }

    $pdf = new PDF();
    $pdf->AliasNbPages();
    $pdf->Output();



    ?>




    ERROR on line 25 >.< "$result=mysql_query('select * from student');" this one


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •