Ver Mensaje Individual
  #5 (permalink)  
Antiguo 22/10/2015, 02:19
ommmm
 
Fecha de Ingreso: octubre-2015
Ubicación: Barcelona
Mensajes: 66
Antigüedad: 8 años, 7 meses
Puntos: 0
Respuesta: Documentos PDF

Muchas gracias lauser!

Pero lo he probado y no se muy bien dónde o como poner-lo.

Es decir, yo tengo un formulario que deben rellenar y también deben adjuntar un pdf. Entiendo mas o menos el código facilitado por lauser, pero no se como poner-lo.

Creo un nuevo script, lo pongo en EmpFrmCreación.php o en EmpCrea.php?


A continuación adjunto los códigos que utilizo, a ver si podéis ayudar-me.
Os lo agradezco mucho.



CODIGO: EmpFrmCreación.php (formulario a rellenar)

Código PHP:
<html>
    <head>
        <title>GRUPO PREMO</title>
        <META http-equiv="Content-Type" CONTENT="text/html; charset=utf-8">
    </head>

    <body bgcolor="#F75353">
    <?php
        
        
include '../header.php';
    
?>    
    
    <center>
    <form name="Formulario" id="Formulario" title="Formulario" action="EmpCrear.php" method="post">
        <table align="center" bgcolor="#A9E2F3">
            <tr>
            <tr>
            <tr>
            <tr>
            <tr>
                <th colspan="3"> <FONT SIZE=6>New RFQ:</font></th>

            </tr>
            <tr>
            <tr>
            <tr>
            <tr>
            <tr>
            <tr>
            <tr>
            <tr>
                <th> <input type="submit" name="PDF" value ="PDF"></th>
                <th>Data</th>
                <td colspan="3"> <input type="text" name="txtdata" size="9" /> 
                </td>
                <th>Project Part Number</th>
                <td colspan="3"> <input type="text" name="txtprojectpartnombre" size="20" /> 
                </td>
                <th>Customer</th>
                <td colspan="3"> <input type="text" name="txtcustomer" size="25"/></td>
                <th>Category</th>
                <td colspan="3"> <input type="text" name="txtNombre" size="20" /> 
                </td>



CODIGO: EmpCrear.php (script que recoge la información del formulario y la pone en la BBDD)

Código PHP:
<html>
    <head>
        <title>GRUPO PREMO</title>
        <META http-equiv="Content-Type" CONTENT="text/html; charset=utf-8">
    </head>

    <body bgcolor="#F75353">
    <center>
<?php
          
        
include '../header.php';
    
?> 
     

        <?php
           
           
            
require_once ('../conexion.inc.php');
            
$db1 = @mysql_connect($servidor,$usuario,$password) or die("Error al conectar al DBMS.");
            @
mysql_select_db($basedatos) or die("Error al conectar a la BD");
            
$Data $_POST['txtdata'];
            
$Suppliers $_POST['txtsupplier'];            
            
$Price $_POST['txtprice'];   
            
$Cry2 $_POST['txtcry2']; 
            
$MOQ $_POST['txtmoq']; 
            
$Volume $_POST['txtvolume'];         
            
$Investment $_POST['txtinvestment']; 
            
$Cry $_POST['txtcry'];        
            
$Timing $_POST['txttiming']; 
             
            
$Incoterms $_POST['txtincoterms']; 
            
$Comments $_POST['txtcomments']; 
            
$Customer $_POST['txtcustomer']; 

            
$query "Insert into rfq(data, suppliers, price, cry2, moq, volume, investment, timing, cry, incoterms)
            VALUES('$Data', '$Suppliers', '$Price', '$Cry2', '$MOQ', '$Volume', '$Investment', '$Timing', '$Cry', '$Incoterms')"
;
            
            if(
mysql_query($query,$db1)) echo "Se ha insertado correctamente";
            else echo 
'¡¡Error en la inserción!!</br>El servidor responde: '.mysql_error();   
            
mysql_close(); 
        
?>

        </center>
    </body>
    
</html>