Ajax with phpmyadmin

Asked

Viewed 49 times

1

I have a form that records the data in phpmyadmin, but when the data is sent, the page of a Reload for php. I researched on ajax, and I saw that it can help me, but I did not understand very well how to use it and also do not know if it is possible to send to the database, I only saw talking about emails.

<?php
$con = mysql_connect("localhost","*$*$*$","*%*%*%**%");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("joinmene_leads", $con);

$sql="INSERT INTO automovel (valor, nome, cidade, telefone, email )
VALUES
('$_POST[Valor]', '$_POST[Nome]','$_POST[Cidade]','$_POST[Telefone]','$_POST[Email]')";

if (!mysql_query($sql,$con))
echo "";


mysql_close($con)
?>

Form:

<form action="insert.php" method="POST">
                        <h4>Valor do consórcio: <span class="slider-value quote-form-element" data-name="Valor | Automóvel" data-slider-id="consorcio-auto">R$ <span></span></span></h4>
                        <div class="slider" data-slider-min="20000" data-slider-max="100000" data-slider-start="23192" data-slider-step="1000" data-slider-id="consorcio-auto"></div>

                        <h4>Seus dados:</h4>
                        <input type="hidden" name="Consórcio" value="Automóvel" />
                        <input type="text" name="Nome" placeholder="Nome..." class="quote-form-element" />
                        <input type="text" name="Cidade" placeholder="Cidade/UF..." class="quote-form-element quote-form-client-email last" />                           
                        <input type="text" name="Telefone" placeholder="Telefone..." class="quote-form-element telefone" />
                        <input type="text" name="Email" placeholder="E-mail..." class="quote-form-element quote-form-client-email last contact_email" />



                        <button class="button button-navy-blue send-quote" type="submit">Simular meu consórcio <i class="fa fa-paper-plane-o"></i></button>

                        <div class="quote-form-thanks">

                            <div class="quote-form-thanks-content">

                                Obrigado pelo seu interesse, retornaremos em breve ;). 
                                <span class="quote-form-thanks-close">Fechar</span>

                            </div>
                            </form>

It is possible to use ajax?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.