Ver Mensaje Individual
  #1 (permalink)  
Antiguo 18/08/2015, 15:55
isisunicornio
 
Fecha de Ingreso: junio-2015
Mensajes: 63
Antigüedad: 8 años, 11 meses
Puntos: 0
Pregunta formulario de php a fpdf y BD

Hola chicos

ultimamente e andado mucho aqui en el for

Tengo una nueva cuestion

esto que les pongo Resuelve perfectamente lo que necesito que es que me inserte un pdf generado por lo que se inserta en el formulario, pero necesito guardarlo en una BD y es lo que no encuentro como, ya que mi BD no me acepta que en name el campo se llame "formulario[nombre]" sino que solo se llame nombre. alguien me podria ayudar que hacer. se los agradeceria muchisimo

index.php

<html>
<head>
<title>Formulario</title>
</head>
<body>
<form name="Formulario" action="pdf.php" method="POST">
<table border="0">
<tr>
<td>Nombre:</td>
<td><input type="text" name="formulario[nombre]" /></td>
</tr>
<tr>
<td>Apellido:</td>
<td><input type="text" name="formulario[apellido]" /></td>
</tr>
<tr>
<td>Estado civil:</td>
<td><input type="text" name="formulario[estado]" /></td>
</tr>
<tr>
<td>Cuit:</td>
<td><input type="text" name="formulario[cuit]" /></td>
</tr>
<tr>
<td>Detalle:</td>
<td><textarea style="width:300px;height:250px;" name="formulario[descripcion]"></textarea></td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="formulario[enviado]" value="enviar" /></td>

</tr>
</table>
</form>
</body>
</html>

pdf.php


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

$pdf=new FPDF();


$data = $_POST['formulario'];

$pdf->SetFont('Arial','',14);
$pdf->AddPage();
$pdf->Cell(($pdf->w-20),20,'',0,1);


$pdf->Cell(25,10,'Nombre:',0,0,'R');
$pdf->Cell(30,10,$data['nombre'],0,0);
$pdf->Cell(($pdf->w -110),10,'',0);
$pdf->Cell(10,10,'Fecha:',0,0,'R');
$pdf->Cell(20,10,date('d/m/Y'),0,1,'L');

$pdf->Cell(25,10,'Apellido:',0,0,'R');
$pdf->Cell(30,10,$data['apellido'],0,1);

$pdf->Cell(25,10,'Estado civil:',0,0,'R');
$pdf->Cell(30,10,$data['estado'],0,1);

$pdf->Cell(25,10,'Cuit:',0,0,'R');
$pdf->Cell(30,10,$data['cuit'],0,1);

$pdf->Cell(25,10,'Descripcion:',0,1,'R');
$pdf->Cell(25,10,'',0,0);
$pdf->MultiCell(0,5,$data['descripcion'],1,1);

$pdf->Output();
?>