Home Forums Porto Template contact-form-recaptcha-v3.php add SELECT sql

  • This topic has 7 replies, 2 voices, and was last updated 4 weeks ago by  Support2. This post has been viewed 107 times
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #10030959
    Niaf
    Participant

    Hi, i used contact-form-recaptcha-v3.php for the contact page
    I would integrate a SELECT sql in this form, problem when i sending the email : msg error

    when i deleted my code, email sending

    so my SELECT sql :

    $bdd = new PDO(‘mysql:host=*********;dbname=*************;charset=utf8′,’***********’,’***********’);
    $reponse = $bdd->query(‘SELECT chapo FROM spip_articles WHERE id_article = “16”‘);
    while ($donnees = $reponse->fetch())
    {
    $soluce = $donnees[‘chapo’];
    }
    $reponse->closeCursor();

    => $recipient = “$soluce”;

    Thanks for help me πŸ™‚


    #10030968
    Support2
    Keymaster

    Hello, thanks for your purchase.

    Seems to be a PHP syntax error on this part of code:

    => $recipient = "$soluce";

    The correct is:

    $recipient = "$soluce";

    If the problem still persists:
    – Check the error.log of your server and share with us. The error should appear there. Normally this file it’s on root of hosting servers but can vary in some hostings, so check with your hosting provider where you can get this log.
    – Make sure you don’t have any syntax php error.
    – Make sure you don’t have any PHP warning or notice on the file “php/contact-form.php”

    Please try that and let us know if you need further assistance.

    Kind Regards,

    Rodrigo.


    #10030970
    Niaf
    Participant

    hi thanks for answer,

    yes the code “=>” it was just ofr exemple

    my code is $recipient = “$soluce”;

    problem has posted : when no SELECT the form is ok, since i have added the SELECT no sending : an error msg

    an idea if there are restrictions in php page ?

    thanks πŸ™‚


    #10030975
    Support2
    Keymaster

    Hello,

    The contact form PHP file don’t have any restriction to use PDO/SQL queries. This should work.

    – Check the error.log of your server and share with us. The error should appear there. Normally this file it’s on root of hosting servers but can vary in some hostings, so check with your hosting provider where you can get this log.
    – Make sure you don’t have any PHP warning or notice on the file β€œphp/contact-form.php” (if yes, this should also appear on the error.log file)

    You are receiving the email in your inbox (even with the error when using the PDO code) ?

    Kind Regards,

    Rodrigo.


    #10030980
    Niaf
    Participant

    hum,

    when i have an error on my form page, the email is not receiving

    my code is good : i have triing with an other select & database connect from an other website & the result is the same
    :/
    the second soluce will be to insert in form an input hidden with the email for recipient with the submit button and in php to write a $email = $_POST[’email’]; but i like the first


    #10030986
    Support2
    Keymaster

    Hello,

    If you can send your error.log file for us here we can try help you with this. Probably there’s some PHP error/notice/warning that’s causing this issue. The only way to see those errors is trough the error.log file.

    Kind Regards,

    Rodrigo.


    #10030993
    Niaf
    Participant

    Hello,

    the problem is solved :

    <input type=”hidden” value=”[(#CHAPO|PtoBr)]” name=”contact”>

    [(#CHAPO|PtoBr)] : my cms result

    and in the php file : $email = $_POST[“contact”];

    I have tested all solutions for my SELECT DATABASE without results πŸ™

    Best regards πŸ™‚


    #10031002
    Support2
    Keymaster

    Hello,

    Great! πŸ™‚

    If you need further assistance feel free to contact us.

    Kind Regards,

    Rodrigo.


Viewing 8 posts - 1 through 8 (of 8 total)