Hi

please help me on php form to pdf conversion and at the same time it should save to database visit this http://servunity.in/form_classII.php I want pdf to look like as in the url

<form id="form_pdf" action="classII.php" method="POST">
        
	<input type="text" class="f_input input1" style="width:200px;" name="surname" maxlength="30" value="Surname" onBlur="if(this.value=='') this.value='Surname'" onFocus="if(this.value =='Surname' ) this.value=''" >
 
 
<input type="text" name="first" class="f_input input1" maxlength="30" style="width:420px;" value="First Name" onBlur="if(this.value=='') this.value='First Name'" onFocus="if(this.value =='First Name' ) this.value=''">

<input type="text" name="initials" class="f_input input1" style="width:141px;" maxlength="10" value="Initials" onBlur="if(this.value=='') this.value='Initials'" onFocus="if(this.value =='Initials' ) this.value=''">


<input type="text" name="res_address1" class="f_input input1" style="width:628px;" maxlength="60" >
<input type="text" name="res_address2" class="f_input input1" style="width:790px;" maxlength="60">

<input type="text" name="city" class="f_input input1" style="width:628px;" maxlength="30">



<input type="text" name="state" class="f_input input1" style="width:288px;" maxlength="30" >
<input type="text" name="pin" class="f_input input1" style="width:274px;" maxlength="10">

<input type="text" name="country" class="f_input input1" style="width:288px;" maxlength="30" >

<input type="text" name="std" class="f_input01 input1" style="width:80px; margin-left:5px; height:26px;" maxlength="6">
<input type="text" name="phone" class="f_input01 input1" style="width:190px; margin-left:5px; height:26px;" maxlength="10">
<input type="text" name="mobile" class="f_input01 input1" style="width:210px; margin-left:5px; height:26px;" maxlength="10" > 

<input type="text" name="email" class="f_inpute input1" style="width:628px;" maxlength="30">
<input type="text" name="identity_details" class="f_input input1" style="width:562px;" maxlength="50">


<input type="text" name="d1" id="d1" class="f_input input1" style="width:32px;" value="D" maxlength="1" onBlur="if(this.value=='') this.value='D'" onFocus="if(this.value =='D' ) this.value=''"  >
<input type="text" name="d2" id="d2" class="f_input input1" style="width:32px;" maxlength="1" value="D" onBlur="if(this.value=='') this.value='D'" onFocus="if(this.value =='D' ) this.value=''"   >
<input type="text" name="m1" id="m1" class="f_input input1" style="width:32px;" maxlength="1" value="M" onBlur="if(this.value=='') this.value='M'" onFocus="if(this.value =='M' ) this.value=''"  >
<input type="text" name="m2" id="m2" class="f_input input1" style="width:32px;" maxlength="1" value="M" onBlur="if(this.value=='') this.value='M'" onFocus="if(this.value =='M' ) this.value=''">
<input type="text" name="y1" id="y1" class="f_input input1" style="width:32px;" maxlength="1" value="Y" onBlur="if(this.value=='') this.value='Y'" onFocus="if(this.value =='Y' ) this.value=''">
<input type="text" name="y2" id="y2" class="f_input input1" style="width:32px;" maxlength="1"  value="Y" onBlur="if(this.value=='') this.value='Y'" onFocus="if(this.value =='Y' ) this.value=''">
<input type="text" name="y3" id="y3" class="f_input input1" style="width:32px;" maxlength="1" value="Y" onBlur="if(this.value=='') this.value='Y'" onFocus="if(this.value =='Y' ) this.value=''">
<input type="text" name="y4" id="y4" class="f_input input1" style="width:32px;" maxlength="1" value="Y" onBlur="if(this.value=='') this.value='Y'" onFocus="if(this.value =='Y' ) this.value=''">
<input type="text" name="nationality" class="f_input input1" style="width:234px;" maxlength="10" >
<input type="text" name="passport_no" class="f_input input1" style="width:305px;" maxlength="10" >
<input type="visa" name="email" class="f_input input1" style="width:684px;" maxlength="10">
<input type="radio" class="f_radio_a_page2" name="ID_proof" value="PAN Card" />
  <input type="radio" class="f_radio_a2_page2" name="ID_proof" value="Driving License"  />
  <input type="radio" class="f_radio_a3_page2" name="ID_proof" value="Voters Id"  />
  <input type="radio" class="f_radio_a2_page2" name="ID_proof" value="Post Office card"  />
   		
         
         <input type="radio" class="f_radio_a4_page2" name="ID_proof" value="Bank Pass Book" />
         
        <input type="radio" class="f_radio_b_page2" name="add_proof" value="Telephone Bill" />
  <input type="radio" class="f_radio_b2_page2" name="add_proof" value="Water Bill"  />
  <input type="radio" class="f_radio_b3_page2" name="add_proof" value="Driving License"  />
  <input type="radio" class="f_radio_b4_page2" name="add_proof" value="Service Tax certificate"  />
      	 
         
        <input type="radio" class="f_radio_b5_page2" name="add_proof" value="Electricity Bill" />
  <input type="radio" class="f_radio_b6_page2" name="add_proof" value="Voters ID"  />
  <input type="radio" class="f_radio_b7_page2" name="add_proof" value="Gas Connection"  />
  <input type="radio" class="f_radio_b8_page2" name="add_proof" value="Corporation Receipt"  />
      	 
        <input type="radio" class="f_radio_b5_page2" name="add_proof" value="PF Statement" />
  <input type="radio" class="f_radio_b6_page2" name="add_proof" value="Passport"  />
  <input type="radio" class="f_radio_b7_page2" name="add_proof" value="Bank Statement"  />
		<input type="text" name="date" class="f_input input1" style="width:286px; height:27px;" maxlength="10">

		<input type="text" name="place" class="f_input input1" style="width:350px; height:27px;" maxlength="10">
        
       <input type="submit" style="font-size:14px;color:#fff; background: url(images/button1_bg2.png); margin-top:5px; cursor:pointer;" value="Submit">

Recommended Answers

All 2 Replies

Saving to a PDF and saving to the database are two totally separate actions even though they can be in the same program. Your ClassII program will receive the output of this form and it can potentially take both actions.

You could save a blank version of the form to a PDF or you could make it a PDF with the fields that were entered by the user. I will assume the latter even though you weren't specific. I suggest that you have a look at HTML2PDF. To make this work, your ClassII program would need to create the form again with the values entered by the user inserted into the form. Instead of displaying it, the form would be saved to a variable and that variable would be passed to HTML2PDF to produce the PDF file.

For the database part, this is standard PHP and MySQL. You get the values entered by the user in the $_POST array and you create an SQL string to insert those values into the database. It's up to you to produce a draft of the ClassII program and try to make it work then come back if you are having a problem. All you've shown us is some HTML so it isn't clear how much you know about PHP and MySQL. If you are familiar with PHP and MySQL then it should be no problem. If not, then you need to find some tutorials and start learning. You can probably find some sample programs doing similar things that will give you a pretty good idea of how to do this.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.