0
<?php
session_start();
include("class/bloqued.php");
include_once("conexao.php");
seguranca_user();
$btnAnunciar = filter_input(INPUT_POST, 'btnAnunciar', FILTER_SANITIZE_STRING);{
if (isset($_POST["generogarota"])){ $generogarotas = $_POST["generogarota"]; }
if (isset($_POST["categarota"])){ $categarotas = $_POST["categarota"]; }
if (isset($_POST["estadogarota"])){ $estadogarotas = $_POST["estadogarota"]; }
if (isset($_POST["titulogarota"])){ $titulogarotas = $_POST["titulogarota"]; }
if (isset($_POST["textgarota"])){ $textgarotas = $_POST["textgarota"]; }
if (isset($_POST["idadegarota"])){ $idadegarotas = $_POST["idadegarota"]; }
if (isset($_POST["telgarota"])){ $telgarotas = $_POST["telgarota"]; }
if (isset($_POST["mailgarota"])){ $mailgarotas = $_POST["mailgarota"]; }
if($btnAnunciar) {
var_dump($resultpub);
include_once("conexao.php");
$result_pub = mysqli_query("INSERT INTO publicacao(garotagenero,garotacat,garotaestado,garotatilt,garotatext,agegarota,garotatel,garotamail,datahora) VALUES ('$generogarotas','$categarotas','$estadogarotas','$titulogarotas','$textgarotas','$idadegarotas','$telgarotas','$mailgarotas' NOW");
$resultado_pub = mysqli_query($conn, $result_pub);
}
?>
Form you will insert
<form action="" method="POST">
<label for="generogarota" class="sectores_on"><span class="field">Genero</span><select name="generogarota" id="publicar_sector" autocomplete="off"><option value="acompanhantes" selected="selected">Selecionar um Genero</option><option value="acompanhantes">Garotas</option><option value="travestis" >Travestis</option></select><br>
<label for="categarota" class="sectores_on"><span class="field">Categorias</span><select name="categarota" id="publicar_sector" autocomplete="off"><option value="acompanhantes" selected="selected">Acompanhantes</option><option value="travestis" >Massagistas</option></select><br>
<label for="estadogarota"><span class="field">Estado</span><select name="estadogarota" id="publicar_provincia" autocomplete="off"><option value="">Selecionar um estado</option><option value="distrito-federal" >Distrito Federal</option><option value="rio-de-janeiro" >Rio de Janeiro</option><option value="sao-paulo" >São Paulo</option><option value="acre" >Acre</option><option value="alagoas" >Alagoas</option><option value="amapa" >Amapá</option><option value="amazonas" >Amazonas</option><option value="bahia" >Bahia</option><option value="ceara" >Ceará</option><option value="espirito-santo" >Espírito Santo</option><option value="goias" >Goiás</option><option value="maranhao" >Maranhão</option><option value="mato-grosso" >Mato Grosso</option><option value="mato-grosso-do-sul" >Mato Grosso do Sul</option><option value="minas-gerais" >Minas Gerais</option><option value="para" >Pará</option><option value="paraiba" >Paraíba</option><option value="parana" >Paraná</option><option value="pernambuco" >Pernambuco</option><option value="piaui" >Piauí</option><option value="rio-grande-do-norte" >Rio Grande do Norte</option><option value="rio-grande-do-sul" >Rio Grande do Sul</option><option value="rondonia" >Rondônia</option><option value="roraima" >Roraima</option><option value="santa-catarina" >Santa Catarina</option><option value="sergipe" >Sergipe</option><option value="tocantins" >Tocantins</option></select></label><br>
<label id="label_publicar_titulo" for="titulogarota"><span class="field">Título</span><input type="text" name="titulogarota" id="publicar_titulo" value="" maxlength="100" autocomplete="off"/><br>
<label class='texto' for="textgarota"><span class="field">Texto</span><textarea name="textgarota" id="publicar_texto" autocomplete="off"></textarea><br>
<label for="idadegarota"><span class="field">Idade</span><select name="idadegarota" id="publicar_edad" autocomplete="off" required=""><option value='18' >18</option><option value='19' >19</option><option value='20' >20</option><option value='21' >21</option><option value='22' >22</option><option value='23' >23</option><option value='24' >24</option><option value='25' >25</option><option value='26' >26</option><option value='27' >27</option><option value='28' >28</option><option value='29' >29</option><option value='30' >30</option><option value='31' >31</option><option value='32' >32</option><option value='33' >33</option><option value='34' >34</option><option value='35' >35</option><option value='36' >36</option><option value='37' >37</option><option value='38' >38</option><option value='39' >39</option><option value='40' >40</option><option value='41' >41</option><option value='42' >42</option><option value='43' >43</option><option value='44' >44</option><option value='45' >45</option><option value='46' >46</option><option value='47' >47</option><option value='48' >48</option><option value='49' >49</option><option value='50' >50</option><option value='51' >51</option><option value='52' >52</option><option value='53' >53</option><option value='54' >54</option><option value='55' >55</option><option value='56' >56</option><option value='57' >57</option><option value='58' >58</option><option value='59' >59</option><option value='60' >60</option><option value='61' >61</option><option value='62' >62</option><option value='63' >63</option><option value='64' >64</option><option value='65' >65</option></select></label><br>
<label id="label_publicar_telefone" for="telgarota"><span class="field">Telefone</span><input type="text" name="telgarota" id="publicar_telefone" value="" maxlength="20" autocomplete="off" placeholder="(DDD) + Numero" /><br>
<label for="mailgarota"><span class="field">Email</span><input type="text" name="mailgarota" id="publicar_email" value="" maxlength="50" autocomplete="off" placeholder="Opcional" /><br>
<!--Parte dos Caches -->
<!-- Fim dos Caches -->
<input type="submit" class="" name="btnAnunciar" value="Publicar">
</form>
Error that is showing
Warning: mysqli_query(): Empty query in line 19
Is factoring a
)
in the end.– Inkeliz
In q part friend?
– LucasRodz
At the end of the query, Ué.
,'$mailgarotas' NOW");
should be,'$mailgarotas', NOW)");
, still missing a comma between the$mailgarotas
andNOW
.– Inkeliz
The first parameter of
MySQLI
need also be the connection, see the manual. It should be something likemysqli_query($conexao, "...")
.– Inkeliz