Problem with Enctype in form

1

Hello,

I have a project being developed in php, everything was done so I hosted the site, when it was hosted I came across a bug that did not happen locally.

I have a form file, this page receives a parameter via GET specifying the type of form and according to the value of this parameter I show the necessary fields, so that's fine, but when I fill in everything and send it it just does not send the If I change to GET the form works perfectly, but this is not possible in the project, and POST is not working hosted, but locally everything is OK.

I discovered that by removing the enctype it works correctly, but I need the enctype because I'm going to send images.

Could you help me?

Here is the code for the form, the code is summarized, in total I have 12 possibilities for the type variable, here it is only 3:

<!--Inclusão do CSS-->
<link rel="stylesheet" type="text/css" href="pages/css/forms.css">

<script src="//cdn.ckeditor.com/4.5.10/standard/ckeditor.js"></script>


<link href="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/css/select2.min.css" rel="stylesheet" />
<script src="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/js/select2.min.js"></script>

<script type="text/javascript" src="pages/js/forms.js"></script>

<form id="formInsere" method='POST' enctype="multipart/form-data" action="<?php echo (isset($_GET['id'])) ? 'php/atualizar_banco' : 'php/inserir_banco' ; ?>">

<table>

<?php

//-----------------------------------------------------------------------------------------------
if($_GET['tipo'] == "admin"){

    if(isset($_GET['id'])){

        //Query de seleção
        $query_select = "SELECT * FROM administradores WHERE id=".$_GET['id'];
        $result_select = mysql_query($query_select);

        $coluna_select = mysql_fetch_assoc($result_select);

    }

?>

    <tr>
        <td>Username:</td>
        <td class="campo"><input type="text" class="texto" name="username" <?php echo (isset($_GET['id']))? "value='".$coluna_select['username']."'" : "" ?> autofocus></td>
    </tr>

    <tr>
        <td><?php echo (isset($_GET['id']))? "Nova senha:" : "Senha:" ; ?></td>
        <td class="campo"><input type="password" class="texto" name="senha" <?php echo (isset($_GET['id']))? "" : "required" ?>></td>
    </tr>

    <tr>
        <td><?php echo (isset($_GET['id']))? "Confirmar nova senha:" : "Confirmar senha:" ; ?></td>
        <td class="campo"><input type="password" class="texto" name="confsenha" <?php echo (isset($_GET['id']))? "" : "required" ?>></td>
    </tr>

<?php   
//-----------------------------------------------------------------------------------------------
}else if($_GET['tipo'] == "home"){

    if(isset($_GET['id'])){

        //Query de seleção
        $query_select = "SELECT * FROM vocesabia WHERE id=".$_GET['id'];
        $result_select = mysql_query($query_select);

        $coluna_select = mysql_fetch_assoc($result_select);

    }

?>

    <tr>
        <td>Voce sabia que...</td>
        <td class="campo"><textarea name="informacao">
            <?php echo (isset($_GET['id']))? $coluna_select['informacao'] : "" ?>
        </textarea></td>
    </tr>

<?php   
//-----------------------------------------------------------------------------------------------
}else if($_GET['tipo'] == "banner"){

    if(isset($_GET['id'])){

        //Query de seleção
        $query_select = "SELECT * FROM banner WHERE id=".$_GET['id'];
        $result_select = mysql_query($query_select);

        $coluna_select = mysql_fetch_assoc($result_select);

    }

?>

    <tr>
        <td>Titulo:</td>
        <td class="campo"><input type="text" class="texto letras" name="titulo" <?php echo (isset($_GET['id']))? "value='".$coluna_select['titulo']."'" : "" ?> autofocus></td>
    </tr>

    <tr>
        <td>Imagem<?php echo (isset($_GET['id']))? " atual" : "" ; ?>:</td>
        <td class="campo">

        <?php

            if(isset($_GET['id'])){
                echo ($coluna_select['imagem'] != "")? 
                "<img src='../pages/src/banner/".$coluna_select['imagem']."'><br>" :
                "<img src='../pages/src/setores/logoPadrao.png'>";
            }

        ?>

            <input type="text" class="texto" id='foto' name="foto_mostrar" placeholder="Foto" title="Foto" readonly/>
            <input hidden type="file" class="texto" id="foto_carregada" name="foto">
        </td>
    </tr>

<?php   
}//Fim if de tipo
?>

    <!--Botões e campos hidden-->
    <tr>
        <td colspan="2"><input type="submit" <?php echo (isset($_GET['id'])) ? 'name="atualizar" value="Atualizar"' : 'name="salvar" value="Salvar"' ; ?> id="btnLogin"></td>
    </tr>
    <tr>
        <td colspan="2"><input type="hidden" name="tipo" value="<?php echo $_GET['tipo'] ?>"></td>
    </tr>
    <?php
    if(isset($_GET['id'])){
    ?>
        <tr>
            <td colspan="2"><input type="hidden" name="id" value="<?php echo $_GET['id'] ?>"></td>
        </tr>
    <?php } ?>

</table>
</form>

<!--Chamadas do editor-->
<script>
    CKEDITOR.replace( 'informacao' );
</script>
    
asked by anonymous 29.11.2016 / 17:06

0 answers