I
I
ikramer2014-09-18 13:42:43
PHP
ikramer, 2014-09-18 13:42:43

How to output data from a feedback form to a table?

There is a simple site (noSQL, i.e. without a database) with a complex feedback form in php. This form is a technological map with many input fields with the ability to attach files.
The data is sent to the mail in the form


Field
name1: value1
Field name2: value2 Field name3:
value3 Field name4: value4

The data needs to be in the form of a table. Or they were substituted into a certain table, which would be saved somewhere.
Tell me, in which direction to dig?
Below is a piece that forms the letter. I can post the whole code, but it's too big.
$company = $_POST['company']; // req

    $name = $_POST['name']; // req

    $phone = $_POST['phone']; // req
 
    $date = $_POST['date']; // req
 
    $s_date = $_POST['s_date'];
 
    $delivery = $_POST['delivery'];
 
    $email_from = $_POST['email']; // req

    $start_time = $_POST['start_time'];

    // $start_time2 = $_POST['start_time2']; 
     
    $r_date = $_POST['r_date'];

    $comments = $_POST['comments'];


    // Тут пошли данные таблицы

    $file_1 = $_POST['file_1'];
    $mat_1 = $_POST['mat_1'];
    $size_1 = $_POST['size_1'];
    $color_1 = $_POST['color_1'];
    $dim_1 = $_POST['dim_1'];
    $quant_1 = $_POST['quant_1'];


    $email_message .= "Компания: ".clean_string($company)."\n";     
    $email_message .= "Имя: ".clean_string($name)."\n";
    $email_message .= "Телефон: ".clean_string($phone)."\n";     
    $email_message .= "Дата: ".clean_string($date)."\n"; 
    $email_message .= "Желаемая дата отгрузки: ".clean_string($s_date)."\n";
    $email_message .= "Доставка: ".clean_string($delivery)."\n";     
    $email_message .= "Email: ".clean_string($email_from)."\n"; 
    $email_message .= "Время приема заказа: ".clean_string($start_time)."\n";
    $email_message .= "Реальная дата отгрузки: ".clean_string($r_date)."\n";    
    $email_message .= "\n\nДанные таблицы, 1 строка: ".clean_string()."\n\n";
    $email_message .= "Наименование файла: ".clean_string($file_1)."\n";
    $email_message .= "Наименование материала: ".clean_string($mat_1)."\n";
    $email_message .= "Толщина материала, мм: ".clean_string($size_1)."\n";
    $email_message .= "Цвет материала: ".clean_string($color_1)."\n";
    $email_message .= "Размер изделия, мм: ".clean_string($dim_1)."\n";
    $email_message .= "Кол-во изделий: ".clean_string($quant_1)."\n";


    $email_message .= "\n\n\nСообщение: ".clean_string($comments)."\n";
      
    $headers = 'От: '.$email_from."\r\n".   
    'Ответить: '.$email_from."\r\n" .     
    'X-Mailer: PHP/' . phpversion();

    $mime_boundary="==Multipart_Boundary_x".md5(mt_rand())."x";

    $tmp_name = $_FILES['filename']['tmp_name'];
    $type = $_FILES['filename']['type'];
    $file_name = $_FILES['filename']['name'];
    $size = $_FILES['filename']['size'];
    if (file_exists($tmp_name)){
        if(is_uploaded_file($tmp_name)){
             $file = fopen($tmp_name,'rb');
             $data = fread($file,filesize($tmp_name));
             fclose($file);
             $data = chunk_split(base64_encode($data));
        }

            $headers .= 
             "MIME-Version: 1.0\r\n" .
             "Content-Type: multipart/mixed;\r\n" .
             " boundary=\"{$mime_boundary}\"";

             $email_message .= 
             "--{$mime_boundary}\n" .
             "Content-Type: text/plain; charset=\"iso-8859-1\"\n" .
             "Content-Transfer-Encoding: 7bit\n\n" .
             $email_message . "\n\n";


             $email_message .= "--{$mime_boundary}\n" .
             "Content-Type: {$type};\n" .
             " name=\"{$file_name}\"\n" .
             //"Content-Disposition: attachment;\n" .
             //" filename=\"{$fileatt_name}\"\n" .
             "Content-Transfer-Encoding: base64\n\n" .
             $data . "\n\n" .
             "--{$mime_boundary}--\n";
    }
 
    @mail($email_to, $email_subject, $email_message, $headers, $headersf);

Answer the question

In order to leave comments, you need to log in

2 answer(s)
B
begemot_nn, 2014-09-18
@begemot_nn

NoSQL - do you mean "without using a database server" or is it really NoSQL?
to solve your question - you need to find in the PHP script the place where it forms the body of the letter, and modify it exactly as you need it.
more without code, only psychics can tell you

I
ikramer, 2014-09-18
@ikramer

OK.
decided this way
but I would like something more elegant.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question