Welcome Guest, Not a member yet? Register   Sign In
form_open_multipart instead form_open no $_POST data
#1

(This post was last modified: 05-13-2024, 10:25 AM by pippuccio76.)

this is my code i in a bootstrap table :
Code:
    <?php
            $attributes = array('class' => 'col-md-12',
                                'id' => 'myform',
                                'name' => 'form_doa_report_righe',
                                'method' => 'POST',
                                  //'onSubmit' => 'return controlla_e_invia();'

                                );
            echo form_open (base_url('/userReport/reportFinale/'.$doa->id) );

        ?>

        <input type="hidden" name="id_doa" value="<?=$doa->id  ?>">


        <div class="row m-5">
       
          <div class="col-md-6">
            <label>DDT Cliente</label>
            <input type="file" name="ddt_cliente" required>

          </div>

          <div class="col-md-6">
            <label>Segnacollo</label>
            <input type="file" name="segnacollo" required>

          </div>
             
        </div>


        <table class="table table-responsive table-striped">
            <thead class="bg-dark text-light">
            <tr>
                        <th scope="col">R.</th>
                        <th scope="col">Codice</th>
                        <th scope="col">Ean <br> Sparato</th>
                        <th scope="col">Ean<br> Inserito</th>
                        <th scope="col">Descrizione</th>
                        <th scope="col">Q.ta <br> Doa</th>
                        <th scope="col">Q.ta <br> Spar.</th>
                        <th scope="col">Inserito<br> Manu.</th>
                        <th scope="col">Stato</th>
                        <th scope="col" style="min-width: 400px;">Note</th>

            </tr>
          </thead>
          <tbody>
                    <?php $n = 1    ?>

                    <?php foreach ($lista as $row) : ?>


                        <?php

                        if ($row->quantita != ($row->numero_prodotti_sparati or $row->inserito_manualmente)) :

                        ?>


                            <?php

                            $style_css = '';

                            if ($row->inserito_manualmente) {
                                //Corrispondente
                                $id_discrepanza_prodotto = 6;
                            } else if ($row->numero_prodotti_sparati != 0 and $row->quantita == 0) {

                                if (in_array($row->codice_ean_sparato, $array_codici_ean_inseriti)) {

                                    //CODICE DIVERSO MA STESSO EAN
                                    $id_discrepanza_prodotto = 3;
                                } else {

                                    //Non Presente su doa
                                    $id_discrepanza_prodotto = 2;
                                }
                            } else if ($row->numero_prodotti_sparati != 0 and $row->quantita != $row->numero_prodotti_sparati) {

                                //Corrispondente ma quantità diverse

                                if ($row->quantita > $row->numero_prodotti_sparati) {

                                    $id_discrepanza_prodotto = 5;
                                } else {

                                    $id_discrepanza_prodotto = 4;
                                }
                            } elseif ($row->numero_prodotti_sparati == 0) {

                                $id_discrepanza_prodotto = 1;
                            }

                            // echo    $style_css    ;
                            ?>


                            <tr >

                                <td scope="row"><input type="text" class="da_leggere" name="num_riga[<?= $n  ?>]" value="<?= $n ?>" size="2" readonly></td>

                                <td scope="row"><input type="text" class="da_leggere"  name="codice_ean[<?= $n  ?>]" value="<?= $row->codice_articolo ?>" size="11" readonly> </td>

                                <input type="hidden" name="id_prodotti[<?= $n ?>]" value="<?= $row->id_prodotti ?>">

                                <td scope="row">
                                    <?php if ($row->codice_ean_sparato){

                                        $value= $row->codice_ean_sparato;
                                   
                                    }else{

                                        $value ='';
                                    }


                                    ?>
                                    <input type="text" class="da_leggere"  name="codice_ean_sparato[<?= $n  ?>]" value="<?= $value ?>" size="11" readonly>
                                </td>

                                <td scope="row">


                                    <?php if ($row->codice_ean_inserito){

                                        $value= $row->codice_ean_inserito;
                                   
                                    }else{

                                        $value ='';
                                    }


                                    ?>
                                    <input type="text" class="da_leggere"  name="codice_ean_inserito[<?= $n  ?>]" value="<?= $value ?>" size="11" readonly>

                                </td>

                                <td scope="row">

                                    <?php if ($row->descrizione){

                                        $value= $row->descrizione;
                                   
                                    }else{

                                        $value ='';
                                    }


                                    ?>
                                    <input type="text" class="da_leggere"  name="descrizione[<?= $n  ?>]" value="<?= $value ?>" size="40" readonly>



                                </td>

                                <td scope="row">

                                    <?php if ($row->quantita){

                                        $value= $row->quantita;
                                   
                                    }else{

                                        $value =0;
                                    }


                                    ?>
                                    <input type="text" class="da_leggere" name="quantita[<?= $n  ?>]" value="<?= $value ?>" size="3" readonly>

                                </td>

                                <td scope="row">

                                   
                                    <?php if ($row->numero_prodotti_sparati){

                                        $value= $row->numero_prodotti_sparati;
                                   
                                    }else{

                                        $value =0;
                                    }


                                    ?>
                                    <input type="text" class="da_leggere" name="numero_prodotti_sparati[<?= $n  ?>]" value="<?= $value ?>" size="3" readonly> 


                                </td>

                                <td scope="row">
                                       
                                                                   
                                    <?php if ($row->inserito_manualmente){

                                        $value= $row->inserito_manualmente;
                                   
                                    }else{

                                        $value =0;
                                    }
    <?php
            $attributes = array('class' => 'col-md-12',
                                'id' => 'myform',
                                'name' => 'form_doa_report_righe',
                                'method' => 'POST',
                                  //'onSubmit' => 'return controlla_e_invia();'

                                );
            echo form_open (base_url('/userReport/reportFinale/'.$doa->id) );

        ?>

        <input type="hidden" name="id_doa" value="<?=$doa->id  ?>">


        <div class="row m-5">
       
          <div class="col-md-6">
            <label>DDT Cliente</label>
            <input type="file" name="ddt_cliente" required>

          </div>

          <div class="col-md-6">
            <label>Segnacollo</label>
            <input type="file" name="segnacollo" required>

          </div>
             
        </div>


        <table class="table table-responsive table-striped">
            <thead class="bg-dark text-light">
            <tr>
                        <th scope="col">R.</th>
                        <th scope="col">Codice</th>
                        <th scope="col">Ean <br> Sparato</th>
                        <th scope="col">Ean<br> Inserito</th>
                        <th scope="col">Descrizione</th>
                        <th scope="col">Q.ta <br> Doa</th>
                        <th scope="col">Q.ta <br> Spar.</th>
                        <th scope="col">Inserito<br> Manu.</th>
                        <th scope="col">Stato</th>
                        <th scope="col" style="min-width: 400px;">Note</th>

            </tr>
          </thead>
          <tbody>
                    <?php $n = 1    ?>

                    <?php foreach ($lista as $row) : ?>


                        <?php

                        if ($row->quantita != ($row->numero_prodotti_sparati or $row->inserito_manualmente)) :

                        ?>


                            <?php

                            $style_css = '';

                            if ($row->inserito_manualmente) {
                                //Corrispondente
                                $id_discrepanza_prodotto = 6;
                            } else if ($row->numero_prodotti_sparati != 0 and $row->quantita == 0) {

                                if (in_array($row->codice_ean_sparato, $array_codici_ean_inseriti)) {

                                    //CODICE DIVERSO MA STESSO EAN
                                    $id_discrepanza_prodotto = 3;
                                } else {

                                    //Non Presente su doa
                                    $id_discrepanza_prodotto = 2;
                                }
                            } else if ($row->numero_prodotti_sparati != 0 and $row->quantita != $row->numero_prodotti_sparati) {

                                //Corrispondente ma quantità diverse

                                if ($row->quantita > $row->numero_prodotti_sparati) {

                                    $id_discrepanza_prodotto = 5;
                                } else {

                                    $id_discrepanza_prodotto = 4;
                                }
                            } elseif ($row->numero_prodotti_sparati == 0) {

                                $id_discrepanza_prodotto = 1;
                            }

                            // echo    $style_css    ;
                            ?>


                            <tr >

                                <td scope="row"><input type="text" class="da_leggere" name="num_riga[<?= $n  ?>]" value="<?= $n ?>" size="2" readonly></td>

                                <td scope="row"><input type="text" class="da_leggere"  name="codice_ean[<?= $n  ?>]" value="<?= $row->codice_articolo ?>" size="11" readonly> </td>

                                <input type="hidden" name="id_prodotti[<?= $n ?>]" value="<?= $row->id_prodotti ?>">

                                <td scope="row">
                                    <?php if ($row->codice_ean_sparato){

                                        $value= $row->codice_ean_sparato;
                                   
                                    }else{

                                        $value ='';
                                    }


                                    ?>
                                    <input type="text" class="da_leggere"  name="codice_ean_sparato[<?= $n  ?>]" value="<?= $value ?>" size="11" readonly>
                                </td>

                                <td scope="row">


                                    <?php if ($row->codice_ean_inserito){

                                        $value= $row->codice_ean_inserito;
                                   
                                    }else{

                                        $value ='';
                                    }


                                    ?>
                                    <input type="text" class="da_leggere"  name="codice_ean_inserito[<?= $n  ?>]" value="<?= $value ?>" size="11" readonly>

                                </td>

                                <td scope="row">

                                    <?php if ($row->descrizione){

                                        $value= $row->descrizione;
                                   
                                    }else{

                                        $value ='';
                                    }


                                    ?>
                                    <input type="text" class="da_leggere"  name="descrizione[<?= $n  ?>]" value="<?= $value ?>" size="40" readonly>



                                </td>

                                <td scope="row">

                                    <?php if ($row->quantita){

                                        $value= $row->quantita;
                                   
                                    }else{

                                        $value =0;
                                    }


                                    ?>
                                    <input type="text" class="da_leggere" name="quantita[<?= $n  ?>]" value="<?= $value ?>" size="3" readonly>

                                </td>

                                <td scope="row">

                                   
                                    <?php if ($row->numero_prodotti_sparati){

                                        $value= $row->numero_prodotti_sparati;
                                   
                                    }else{

                                        $value =0;
                                    }


                                    ?>
                                    <input type="text" class="da_leggere" name="numero_prodotti_sparati[<?= $n  ?>]" value="<?= $value ?>" size="3" readonly> 


                                </td>

                                <td scope="row">
                                       
                                                                   
                                    <?php if ($row->inserito_manualmente){

                                        $value= $row->inserito_manualmente;
                                   
                                    }else{

                                        $value =0;
                                    }


                                    ?>
                                    <input type="text" class="da_leggere" name="inserito_manualmente[<?= $n  ?>]" value="<?= $value ?>" size="3" readonly> 

                                </td>
                                <td scope="row">

                                    <select id='id_id_extra_doa' class='form-select' name='id_discrepanza_prodotto[<?= $n  ?>]'>
                                        <option value=''>Seleziona un valore...</option>
                                        <?php foreach ($tutti_id_discrepanze_prodotti as $v) : ?>

                                            <option value='<?= $v->id ?>' <?php if ($v->id == set_value('id_discrepanza_prodotto') or $v->id == $id_discrepanza_prodotto) : ?> selected='selected' <?php endif ?>>

                                                <?= $v->nome ?>

                                            </option>

                                        <?php endforeach ?>
                                    </select>


                                </td>

                                <td scope="row">

                                    <input type="text" name="note[<?= $n  ?>]" value="<?=set_value("note['". $n  ."']")  ?>" class="form-control">

                                </td>

                            </tr>

                            <?php $n++    ?>

                        <?php endif; ?>


                    <?php endforeach; ?>

                </tbody>
           




            </table>

        </div>
    </div>
</div>

<div class="row text-end m-2">
      <div class="col-md-12">
           

            <span>note: * campi obbligatori</span>
          <div class='text-right'>
          <a href='<?= base_url() ?>' class='btn btn-danger'>Annulla</a>
          <button class='btn btn-info submit-btn' type='submit' onclick=''>
          <span class='indicator-label'>
                INSERISCI
            </span>
            <span class='indicator-progress'>
                Perfavore attendi... <span
                    class='spinner-border spinner-border-sm align-middle ms-2'></span>
            </span>
         
          </button>      </div>
          <br>
       



      </div>
     
</div>    <?php
            $attributes = array('class' => 'col-md-12',
                                'id' => 'myform',
                                'name' => 'form_doa_report_righe',
                                'method' => 'POST',
                                  //'onSubmit' => 'return controlla_e_invia();'

                                );
            echo form_open (base_url('/userReport/reportFinale/'.$doa->id) );

        ?>

        <input type="hidden" name="id_doa" value="<?=$doa->id  ?>">


        <div class="row m-5">
       
          <div class="col-md-6">
            <label>DDT Cliente</label>
            <input type="file" name="ddt_cliente" required>

          </div>

          <div class="col-md-6">
            <label>Segnacollo</label>
            <input type="file" name="segnacollo" required>

          </div>
             
        </div>


        <table class="table table-responsive table-striped">
            <thead class="bg-dark text-light">
            <tr>
                        <th scope="col">R.</th>
                        <th scope="col">Codice</th>
                        <th scope="col">Ean <br> Sparato</th>
                        <th scope="col">Ean<br> Inserito</th>
                        <th scope="col">Descrizione</th>
                        <th scope="col">Q.ta <br> Doa</th>
                        <th scope="col">Q.ta <br> Spar.</th>
                        <th scope="col">Inserito<br> Manu.</th>
                        <th scope="col">Stato</th>
                        <th scope="col" style="min-width: 400px;">Note</th>

            </tr>
          </thead>
          <tbody>
                    <?php $n = 1    ?>

                    <?php foreach ($lista as $row) : ?>


                        <?php

                        if ($row->quantita != ($row->numero_prodotti_sparati or $row->inserito_manualmente)) :

                        ?>


                            <?php

                            $style_css = '';

                            if ($row->inserito_manualmente) {
                                //Corrispondente
                                $id_discrepanza_prodotto = 6;
                            } else if ($row->numero_prodotti_sparati != 0 and $row->quantita == 0) {

                                if (in_array($row->codice_ean_sparato, $array_codici_ean_inseriti)) {

                                    //CODICE DIVERSO MA STESSO EAN
                                    $id_discrepanza_prodotto = 3;
                                } else {

                                    //Non Presente su doa
                                    $id_discrepanza_prodotto = 2;
                                }
                            } else if ($row->numero_prodotti_sparati != 0 and $row->quantita != $row->numero_prodotti_sparati) {

                                //Corrispondente ma quantità diverse

                                if ($row->quantita > $row->numero_prodotti_sparati) {

                                    $id_discrepanza_prodotto = 5;
                                } else {

                                    $id_discrepanza_prodotto = 4;
                                }
                            } elseif ($row->numero_prodotti_sparati == 0) {

                                $id_discrepanza_prodotto = 1;
                            }

                            // echo    $style_css    ;
                            ?>


                            <tr >

                                <td scope="row"><input type="text" class="da_leggere" name="num_riga[<?= $n  ?>]" value="<?= $n ?>" size="2" readonly></td>

                                <td scope="row"><input type="text" class="da_leggere"  name="codice_ean[<?= $n  ?>]" value="<?= $row->codice_articolo ?>" size="11" readonly> </td>

                                <input type="hidden" name="id_prodotti[<?= $n ?>]" value="<?= $row->id_prodotti ?>">

                                <td scope="row">
                                    <?php if ($row->codice_ean_sparato){

                                        $value= $row->codice_ean_sparato;
                                   
                                    }else{

                                        $value ='';
                                    }


                                    ?>
                                    <input type="text" class="da_leggere"  name="codice_ean_sparato[<?= $n  ?>]" value="<?= $value ?>" size="11" readonly>
                                </td>

                                <td scope="row">


                                    <?php if ($row->codice_ean_inserito){

                                        $value= $row->codice_ean_inserito;
                                   
                                    }else{

                                        $value ='';
                                    }


                                    ?>
                                    <input type="text" class="da_leggere"  name="codice_ean_inserito[<?= $n  ?>]" value="<?= $value ?>" size="11" readonly>

                                </td>

                                <td scope="row">

                                    <?php if ($row->descrizione){

                                        $value= $row->descrizione;
                                   
                                    }else{

                                        $value ='';
                                    }


                                    ?>
                                    <input type="text" class="da_leggere"  name="descrizione[<?= $n  ?>]" value="<?= $value ?>" size="40" readonly>



                                </td>

                                <td scope="row">

                                    <?php if ($row->quantita){

                                        $value= $row->quantita;
                                   
                                    }else{

                                        $value =0;
                                    }


                                    ?>
                                    <input type="text" class="da_leggere" name="quantita[<?= $n  ?>]" value="<?= $value ?>" size="3" readonly>

                                </td>

                                <td scope="row">

                                   
                                    <?php if ($row->numero_prodotti_sparati){

                                        $value= $row->numero_prodotti_sparati;
                                   
                                    }else{

                                        $value =0;
                                    }


                                    ?>
                                    <input type="text" class="da_leggere" name="numero_prodotti_sparati[<?= $n  ?>]" value="<?= $value ?>" size="3" readonly> 


                                </td>

                                <td scope="row">
                                       
                                                                   
                                    <?php if ($row->inserito_manualmente){

                                        $value= $row->inserito_manualmente;
                                   
                                    }else{

                                        $value =0;
                                    }


                                    ?>
                                    <input type="text" class="da_leggere" name="inserito_manualmente[<?= $n  ?>]" value="<?= $value ?>" size="3" readonly> 

                                </td>
                                <td scope="row">

                                    <select id='id_id_extra_doa' class='form-select' name='id_discrepanza_prodotto[<?= $n  ?>]'>
                                        <option value=''>Seleziona un valore...</option>
                                        <?php foreach ($tutti_id_discrepanze_prodotti as $v) : ?>

                                            <option value='<?= $v->id ?>' <?php if ($v->id == set_value('id_discrepanza_prodotto') or $v->id == $id_discrepanza_prodotto) : ?> selected='selected' <?php endif ?>>

                                                <?= $v->nome ?>

                                            </option>

                                        <?php endforeach ?>
                                    </select>


                                </td>

                                <td scope="row">

                                    <input type="text" name="note[<?= $n  ?>]" value="<?=set_value("note['". $n  ."']")  ?>" class="form-control">

                                </td>

                            </tr>

                            <?php $n++    ?>

                        <?php endif; ?>


                    <?php endforeach; ?>

                </tbody>
           




            </table>

        </div>
    </div>
</div>

<div class="row text-end m-2">
      <div class="col-md-12">
           

            <span>note: * campi obbligatori</span>
          <div class='text-right'>
          <a href='<?= base_url() ?>' class='btn btn-danger'>Annulla</a>
          <button class='btn btn-info submit-btn' type='submit' onclick=''>
          <span class='indicator-label'>
                INSERISCI
            </span>
            <span class='indicator-progress'>
                Perfavore attendi... <span
                    class='spinner-border spinner-border-sm align-middle ms-2'></span>
            </span>
         
          </button>      </div>
          <br>
       



      </div>
     
</div>
   


</form>
   


</form>

                                    ?>
                                    <input type="text" class="da_leggere" name="inserito_manualmente[<?= $n  ?>]" value="<?= $value ?>" size="3" readonly> 

                                </td>
                                <td scope="row">

                                    <select id='id_id_extra_doa' class='form-select' name='id_discrepanza_prodotto[<?= $n  ?>]'>
                                        <option value=''>Seleziona un valore...</option>
                                        <?php foreach ($tutti_id_discrepanze_prodotti as $v) : ?>

                                            <option value='<?= $v->id ?>' <?php if ($v->id == set_value('id_discrepanza_prodotto') or $v->id == $id_discrepanza_prodotto) : ?> selected='selected' <?php endif ?>>

                                                <?= $v->nome ?>

                                            </option>

                                        <?php endforeach ?>
                                    </select>


                                </td>

                                <td scope="row">

                                    <input type="text" name="note[<?= $n  ?>]" value="<?=set_value("note['". $n  ."']")  ?>" class="form-control">

                                </td>

                            </tr>

                            <?php $n++    ?>

                        <?php endif; ?>


                    <?php endforeach; ?>

                </tbody>
           




            </table>

        </div>
    </div>
</div>

<div class="row text-end m-2">
      <div class="col-md-12">
           

            <span>note: * campi obbligatori</span>
          <div class='text-right'>
          <a href='<?= base_url() ?>' class='btn btn-danger'>Annulla</a>
          <button class='btn btn-info submit-btn' type='submit' onclick=''>
          <span class='indicator-label'>
                INSERISCI
            </span>
            <span class='indicator-progress'>
                Perfavore attendi... <span
                    class='spinner-border spinner-border-sm align-middle ms-2'></span>
            </span>
         
          </button>      </div>
          <br>
       



      </div>
     
</div>
   


</form>
in my controller :
Code:
            echo '<pre>';
            print_r($_POST);
            print_r($_FILES);
            echo '</pre>';
            die();
in view:
Code:
Array
(
    [id_doa] => 29
    [ddt_cliente] => AdobeStock_207384835.jpeg
    [segnacollo] => 524500914666_2024_s.pdf
    [num_riga] => Array
        (
            [1] => 1
        )

    [codice_ean] => Array
        (
            [1] => 00S650000KEBG
        )

    [id_prodotti] => Array
        (
            [1] => 5001
        )

    [codice_ean_sparato] => Array
        (
            [1] => 5011423148755
        )

    [codice_ean_inserito] => Array
        (
            [1] =>
        )

    [descrizione] => Array
        (
            [1] => *ST390 FSV KENWOOD WHBL IL
        )

    [quantita] => Array
        (
            [1] => 0
        )

    [numero_prodotti_sparati] => Array
        (
            [1] => 1
        )

    [inserito_manualmente] => Array
        (
            [1] => 0
        )

    [id_discrepanza_prodotto] => Array
        (
            [1] => 2
        )

    [note] => Array
        (
            [1] => test
        )

)
Array
(
)
if change form_open to form_open_multipart this is my view :
Code:
Array
(
)
Array
(
)
readonly is disable on form submit
why there is no data ?
Reply
#2

Do this way instead

PHP Code:
<?php
       
   
echo form_open ('/userReport/reportFinale/'.$doa->id,['class' => 'col-md-12''id' => 'myform''name' => 'form_doa_report_righe','onSubmit' => 'return controlla_e_invia();']) ;

        
?>
Codeigniter First, Codeigniter Then You!!
yekrinaDigitals

Reply
#3

(This post was last modified: 05-13-2024, 11:04 PM by pippuccio76.)

(05-13-2024, 08:04 PM)luckmoshy Wrote: Do this way instead

PHP Code:
<?php
      
  
echo form_open ('/userReport/reportFinale/'.$doa->id,['class' => 'col-md-12''id' => 'myform''name' => 'form_doa_report_righe','onSubmit' => 'return controlla_e_invia();']) ;

        ?>

I must send two file , can i send without multipart ?
Reply




Theme © iAndrew 2016 - Forum software by © MyBB