i am making simple experiment about html to pdf.i can populate all the textfields but not the check boxes,i used radio button in html so that only one can picked on the two.how can i possibly populate the checkboxes in pdf??please help!

here is my code:

						border: 15px solid black;
						padding: 5px;
						background-color: white;
						color: black;
					 	background-color: blue;
						color: white;
					         font-size 16px;
					         border: 1px solid #66666;

<form method="post" action="http://localhost/fpdf/submit_form.php">
<table border = 1 bgcolor = "skyblue" width= 100% height = 40% align = left>
<tr height = 30%><td valign = top>
<legend>Student Details</legend>
   <div class = "line">Family Name</div><input type="text" name="Fname" />
   <div class = "line">Given Name</div><input type="text" name="Gname" />
   <div class = "line">Preferred Name</div><input type="text" name="Pname" />
   <div class = "line">Proposed Commencement Date</div><input type="text" name="PCD" />
   <div class = "line">Proposed Length of course (weeks)</div><input type="text" name="PLOC" />
   <div class = "line">Date Of Birth (dd/mm/yy)</div><input type="text" name="DOB" />

	<div class = "line">Gender</div>
   <label>Male</label><input unchecked  "selected" type="radio" name="sex" value = "male" />
   <label>Female</label><input unChecked = "selected" type="radio" name="sex" value = "female"/>

   <div class = "line">Parents Name if under 18</div><input type="text" name="Parname" />
   <div class = "line">Country of Birth</div><input type="text" name="COB" />
   <div class = "line">Current Overseas Address</div><input type="text" name="COA" />
   <div class = "line">Email Address</div><input type="text" name="Eadd" />
   <div class = "line">Next of Kin</div><input type="text" name="NOK" />
   <div class = "line">Next of Kin Address</div><input type="text" name="NOKA" />
   <div class = "line">Next of Kin Telephone</div><input type="text" name="NOKT" />


<td valign = top>
<legend>Background Information</legend></br>
	<div>Guidance Officer</div>
   <label>Yes</label><input unchecked  "selected" type="radio" name="r1" value = "yes" />
   <label>No<label><input unChecked = "selected" type="radio" name="r1" value = "no"/>

   <label>Yes</label><input unchecked  "selected" type="radio" name="r2" value = "yes" />
   <label>No</label><input unChecked = "selected" type="radio" name="r2" value = "no"/>

   <label>Yes</label><input unchecked  "selected" type="radio" name="r3" value = "yes" />
   <label>No</label><input unChecked = "selected" type="radio" name="r3" value = "no"/>

	<div>Hearing Impaired Services</div></br>
   <label>Yes</label><input unchecked  "selected" type="radio" name="r4" value = "yes" />
   <label>No</label><input unChecked = "selected" type="radio" name="r4" value = "no"/>

	<div>Physically Handicapped Services</div></br>
   <label>Yes</label><input unchecked  "selected" type="radio" name="r5" value = "yes" />
   <label>No</label><input unChecked = "selected" type="radio" name="r5" value = "no"/>

	<div>Visual Services</div></br>
   <label>Yes</label><input unchecked  "selected" type="radio" name="r6" value = "yes" />
   <label>No</label><input unChecked = "selected" type="radio" name="r6" value = "no"/>

	<div>Speech Therapist</div></br>
   <label>Yes</label><input unchecked  "selected" type="radio" name="r7" value = "yes" />
   <label>No</label><input unChecked = "selected" type="radio" name="r7" value = "no"/>
<tr height = 70%><td valign = top>
<legend>Educational History</legend></br>	

   <div class = "line">How many years of schooling have you completed?</div><input type="text" name="Yschool"/>
   <div class = "line">How long have you learned English?</div><input type="text" name="Lenglish" />
<td valign = top>
<legend>Academic Details</legend></br>
   <div class = "line">Present Education Institution</div><input type="text" name="PEI" />
   <div class = "line">Education Institution Address</div><input type="text" name="EIA" />
   <div class = "line">IELTS Test Score</div><input type="text" name="ITscore" />
   <div class = "line">Highest level of Education achieved in home country</div><input type="text" name="Eachieved" />
   <div class = "line">If not still attending - date of last attendance</div><input type="text" name="Lattend" />
<table border = 1 bgcolor = "skyblue" width= 100% height = 40% align = left>
<tr height = 30%><td valign = top>	
<legend>Course Details</legend></br>
   <div class = "line">Proposed start date of course</div><input type="text" name="SDcourse" /></br>
	<div>Proposed tertiary level course (Univ/Vet)</div>
   <label>Certificate II</label><input checked='yes'  "selected" type="radio" name="r8" value = "CertificateII" />
   <label>Certificate III</label><input unChecked = "selected" type="radio" name="r8" value = "CertificateIII"/>
   <label>Certificate IV</label><input unChecked = "selected" type="radio" name="r8" value = "CertificateIV"/></br>
   <labrl>Other:</label><input type="text" name="TLcourse" />

  <input type="submit" value="Generate FDF Data" />

   echo '<pre>'; print_r($_POST); echo '</pre>';

if(isset($_POST) && is_array($_POST) && count($_POST))
  echo'<pre>POST '; print_r($_POST);
  echo '</pre>';
     if(empty($_POST['Fname']) || preg_match($pat,$_POST['Fname']))
         die('Invalid input for Fname field.');            

$img= "<img src='check.png' width='15' height='17' alt='airportindicator'>"; 

if(isset($_POST['sex']) && $_POST['sex'] == 'male') 
	    echo "Male";
	    echo "Female";

     $data['Family Name']=$_POST['Fname'];            





     require_once 'createFDF.php';
       echo $fdf_file,' written successfully.';            
       die('Unable to create file: '.$fdf_dir.'\\'.$fdf_file);


  echo 'You did not submit a form.';    


Edited by __avd: Added [code] tags. Do wrap your programming code blocks within [code] ... [/code] tags

6 Years
Discussion Span
Last Post by Kristof_1

The OP is not generating a pdf...the OP is creating an FDF document and specifying a form fillable pdf that loads with the populated data.

When I have generated xFDF the xml version of fdf, the checkboxes have all been setup as unique fields, e.g. Payment_Visa, Payment_Mastercard, Payment_Amex etc. Then to fill a particular checkbox I would pass it the value of Yes.

When I look at the fillable form, the checkboxes, under the options tab, have the Export Value of 'Yes' without the quotes.

Hope this helps.


i already populated the checkboxes,i just used an image $img = 'X'; to be passed to the pdf document,i made the "checkbox field" to "textbox field" in the pdf document.then i only passed the selecteditem on the radio button.thank you guys.

i am having now a difficulty in connecting to database.maybe you can give me a tutorial on how to make a databse on xampp(mysql).thank you!


i have forgotten. i used this code because i need to call the values from database to be place on the input types, so that if the user already filled the fields the second time they visit the site,the input type will automatically populated and ready for editing only.so that the users will never fill up the fields again.


Hello dangerousdayton, can you please post the code that you have applied to translate the output from the checkboxes to have an 'x' placed in the appropriate field of the pdf?
Or if anyone else knows how to code this solution?
Any help is much appreciated.
Best regards,

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.