Tengo un formulario en el que los datos se guardan en un Excel. El problema ahora es que me pide el cliente que el formulario incluya un campo que muestre la ruta de la imagen en el Excel junto con los demás datos, para así identificar a cada cliente. Tengo otro script dónde guardo las imágenes en un directorio.
Estoy buscando por san google y demás pero no doy con la solución, encima estoy muy limitado con php.
Pongo el código para facilitar la ayuda, éste es el código de inscripcion.php:
Código HTML:
Ver original
Para crear el Excel, utilizo la clase agpform1.7, encontré en google:
Código PHP:
Ver original
<?php // Change this to the page you want the user to be redirected to after form is submitted (i.e. success.html and error.html) $success = "confirmacion.php"; $error = "negacion.php"; // Change this to the character(s) you want to be placed instead of line breaks(new line, enter, etc) $lbChar = " "; // default is a space, you may change it to whatever you want // Don't change anything below this line // Determine if the form was sent through the GET methog or the POST method. if($_POST){ $array = $_POST; } else if($_GET){ $array = $_GET; } else { die("You must Access this file through a form."); // If someone accesses the file directly, it wont work :) } //Check if the filename was sent through the form or not if(!$array['filename']){ // if the filename wasnt sent through the form, it will become form.xls, you can change the default if you want. $array['filename'] = "clientes.xls"; //Set the file to save the information in } else { $array['filename'] = $array['filename'] . ".xls"; } } // Define the tab and carriage return characters: $tab = "\t"; //chr(9); $cr = "\n"; //chr(13); if($array){ // Make The Top row for the excel file and store it in the $header variable foreach($keys as $key){ $header .= $key . $tab; } } $header .= $cr; //Make the line with the contents to write to the excel file. foreach($keys as $key){ $data .= $array[$key] . $tab ; } } $data .= $cr; $final_data = $data; // If the file does exist, then only write the information the user sent } else { $final_data = $header . $data; // If file does not exist, write the header(first line in excel with titles) to the file } // open the file and write to it if($fp){ // Success } else { // Error } } ?>
El problema es que el Excel me genera todos los datos, salvo el campo con la ruta de la imagen que indique que se trata de una imagen.Si son tan amables, espero vuestra ayuda.
Gracias por anticipado.