I'am Generating a PDF with the help oh HTML and PHP. But the text in textarea in getting overflowed. The text in printing only in a single line. My HTML Code is
<html>
<head>
<title>registration form</title>
</head>
<h2 ALIGN="CENTER">Registration form</h2>
<form action="pro1.php" method="post">
<table border="0" align="center">
<tbody>
<tr>
<td><label for="id">Id: </label></td>
<td><input id="id" maxlength="50" name="name" type="text" /></td>
</tr>
<tr>
<td><label for="name">Name: </label></td>
<td><input id="name" maxlength="50" name="name" type="text" /></td>
</tr>
<tr>
<td><label for="course">Course: </label></td>
<td><input id="course" maxlength="50" name="course" type="text" /></td>
</tr>
<tr>
<td><label for="branch">Branch: </label></td>
<td><input id="branch" maxlength="50" name="branch" type="text" /></td>
</tr>
<tr>
<td><label for="rolln0">Rollno: </label></td>
<td><input id="rollno" maxlength="50" name="rollno" type="text" /></td>
</tr>
<tr>
<td><label for="email">Email_Address:</label></td>
<td><input id="email" maxlength="50" name="email" type="text" /></td>
</tr>
<tr>
<td><label for="username">User_Name:</label></td>
<td><input id="username" maxlength="50" name="username" type="text" /></td>
</tr>
<tr>
<td><label for="aboutus">About Us:</label></td>
<td valign="middle" align="center"><textarea wrap="wrap" rows ="1" cols ="1" name = "aboutus"></textarea></td>
</tr>
<tr>
<td><label for="password">Password:</label></td>
<td><input id="password" maxlength="50" name="password"
type="password" /></td>
</tr>
<tr>
<td align="right"><input name="Submit" type="Submit" value="Add" /></td>
</tr>
</tbody>
</table>
</form>
</html>
and my PHP Code is
require('fpdf/fpdf.php');
$pdf = new FPDF();
//var_dump(get_class_methods($pdf));
$pdf -> AddPage();
$pdf->SetFont("Arial","B",16);
$pdf->Cell(0,10,"Welcome {$pro_name}",1,1);
$pdf->Cell(50,10,"Name: ",1,0);
$pdf->Cell(50,10,$pro_name,1,1);
$pdf->Cell(50,10,"Branch: ",1,0);
$pdf->Cell(50,10,$pro_branch,1,1);
$pdf->Cell(50,10,"Roll No: ",1,0);
$pdf->Cell(50,10,$pro_rollno,1,1);
$pdf->Cell(50,10,"Email: ",1,0);
$pdf->Cell(50,10,$pro_email,1,1);
$pdf->Cell(50,10,"About Us: ",1,0);
$pdf->Cell(50,10,$pro_aboutus,1,1);
$pdf->output();
}
?>
please help me, and tell me what should i do so that my text area prints within the a4. Thank You In Advance
Use MultiCell rather than Cell. As it says, "This method allows printing text with line breaks."
Example:
$this->MultiCell(60,5,$txt);