Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php FPDF-在一次创建中生成多个pdf_Php_Fpdf - Fatal编程技术网

Php FPDF-在一次创建中生成多个pdf

Php FPDF-在一次创建中生成多个pdf,php,fpdf,Php,Fpdf,我试图在php表单中单击一次就使用fpdf生成多个集群内pdf报告 测试中心是独立报告的集群。单击submit按钮时,它将调用fpdf的php文件。我的密码还没用 到目前为止,在我的php中: <?php $program="select distinct test_center from sa_sase_result where school_year = '$content' "; $prog=mysql_query($program); while($row = mysql_fet

我试图在php表单中单击一次就使用fpdf生成多个集群内pdf报告

测试中心是独立报告的集群。单击submit按钮时,它将调用fpdf的php文件。我的密码还没用

到目前为止,在我的php中:

<?php
$program="select distinct test_center  from sa_sase_result where school_year = '$content' ";
$prog=mysql_query($program);
while($row = mysql_fetch_array($prog))
{
    echo '<option>' .$row['test_center'] . '</option>';      
}  

$message = null;

if($_SERVER["REQUEST_METHOD"] == "POST") { 
    if(!isset($_POST['depchair'])) {

    } else if($_POST['depchair']=="") {

    } else {            
        $input_depchair = addslashes($_POST['depchair']);                       

        $input_depchair = addslashes($_POST['depchair']);
        $pro_email="select control_no  from sa_student_infoe y where y.test_center = '$input_depchair'";
        $pro_address=mysql_query($pro_email);

        $address = mysql_result($pro_address, 0);
    }                   
}
?>
编辑:这里是generate_pdf.php文件

<?php

require('fpdf/fpdf.php');


 mysql_connect("localhost", "root", "1234") or die(mysql_error()); 
 mysql_select_db("final") or die(mysql_error()); 

 $query = "SELECT * FROM sa_student_infoe, sa_student_edubg, sa_sase_result, sa_accounts";
      $result = mysql_query($query) or die(mysql_error());
      while($row = mysql_fetch_array($result, MYSQL_BOTH)){
      $control_no[] = $row['control_no'];
      $surname[] = $row['surname'];
      $fname[] = $row['fname'];
      $mname[] = $row['mname'];
      $app_no[] = $row['activation_code'];
      $schoolyear[] = $row['schoolyear'];
      $schl[] = $row['high_school'];
      $schl_ad[] = $row['address_school']; 
      $apt[] = $row['aptitude']; 
      $mth[] = $row['math'];
      $lng[] = $row['language'];
      $sci[] = $row['science'];
      $totgrd[] = $row['total_grade'];
      $sx[] = $row['sex'];

      }

 $ctrl_no = array_shift( $control_no );
 $sname = array_shift( $surname );
 $firstname = array_shift( $fname );
 $midname = array_shift( $mname );
 $appno = array_shift( $app_no );
 $schyear = array_shift( $schoolyear );
 $school = array_shift( $schl );
 $school_ad = array_shift( $schl_ad );
 $aptitude = array_shift( $apt );
 $math = array_shift( $mth );
 $lang = array_shift( $lng );
 $science = array_shift( $sci );
 $gr = array_shift( $totgrd );
 $sex = array_shift( $sx );


$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','', 12);


$pdf->Cell(0, 0,'Mindanao State University', 0, 1, 'C');
$pdf->Cell(0, 10,'System Admission and Scholarship Examination (SASE)', 0, 1, 'C');
$pdf->Cell(0, 20,'REPORT OF RATING', 0, 1, 'C');


$pdf->Cell(30,5,'Control No:');
$pdf->Cell(100,5,$ctrl_no);
$pdf->Cell(30,5,'School Year:');
$pdf->Cell(-160,5,$schyear);
$pdf->Cell(30,15,'Activation Code:');
$pdf->Cell(10,15,'   ' . $appno);


$pdf->Cell(50,40,$sname);
$pdf->Cell(50,40,$firstname);
$pdf->Cell(-120,40,$midname);
$pdf->Cell(15,50,'____________________________________________________________________');
$pdf->Cell(50,60,'LASTNAME');
$pdf->Cell(50,60,'FIRSTNAME');
$pdf->Cell(-50,60,'MIDDLENAME');

$pdf->Cell(-65,90,$school);
$pdf->Cell(67,100,'____________________________________________________________________');
$pdf->Cell(-15,110,'SCHOOL');

$pdf->Cell(-52,140,$school_ad);
$pdf->Cell(57,150,'____________________________________________________________________');
$pdf->Cell(-25,160,'SCHOOL ADDRESS');

$pdf->Cell(.1,190,'--------------------------------------------------------------------');
$pdf->Cell(-35,200,'--------------------------------------------------------------------'); 

$pdf->Cell(17,230,'AP(30):');
$pdf->Cell(18,230,$aptitude);
$pdf->Cell(17,230,'LU(80):');
$pdf->Cell(18,230,$lang);
$pdf->Cell(17,230,'MA(40):');
$pdf->Cell(18,230,$math);
$pdf->Cell(17,230,'SC(30):');
$pdf->Cell(18,230,$science);
$pdf->Cell(18,230,'GR(180):');
$pdf->Cell(-300,230,$gr);  


$pdf->Cell(-10,260,'SEX:');


$pdf->Output("pdf_reports/SASE_report_rating/".$ctrl_no.".pdf", "F");


?>
js:


... 有什么问题吗?它不起作用。它不会一次生成多个报告。报告中将包含哪些字段以及输出内容?就因为我不能复制输出,您可以将输出作为屏幕截图公开吗?名称、年龄等字段位于fpdf的单独php文件中。对于html代码,用户可以选择创建报告所需的集群。集群是一组学生。所以用户基本上是在所选集群中创建学生报告。当然,我会上传一个屏幕截图。谢谢你没有放弃我。我不熟悉javascriptjs,你能帮我浏览一下吗?它只是为你准备的模板。我看不出每个文件的生成代码定义在哪里。此php将用于生成不同的文件,这意味着此代码必须读取$_REQUEST['q'],并在sql中为每个案例选择数据。就像:$query=SELECT*fromsa_student_infoe,sa_student_edubg,sa_sase_result,sa_accounts,其中一些字段='$_请求['q'];
$("#id_of_generate_it_button").click(function () {
    var N = 10;// ten pdf files will be generated and stored to the disk
    for (i = 0; i < N; i++) {// 'the loop' -- walk thru all parallel generation processes connected to the event
        parameter = N;// just to definite each single generated file
        $.get("generate.php?q=parameter", function (data) {// start the ajax process to generate single document
                                                           // ?q=parameter i wrote just for passing to the php file some dependent parameter for each single file 
            // pdf #i generated
        });
    }// end for parallel generating N pdf files to the disk
});//end click 
$query = "SELECT * FROM sa_student_infoe, sa_student_edubg, sa_sase_result, sa_accounts WHERE some_field = ' . $_REQUEST['q'] . '";// single record from all