form not showing up on page with PHP

Home Forums Quform WordPress form not showing up on page with PHP

This topic is: resolved
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #4479
    rubyj
    Participant

    I built an order form that I would like to display on a page that has some PHP in it. The PHP code pulls inputs from an HTML form on another page and displays a message based on some conditions, but my form won’t show up.

    Here is what I have on my page:
    [insert_php] //this is the shortcode for a PHP plugin in wordpress

    $fname = $_POST['firstname'];
    $lname = $_POST['lasname'];
    $email = $_POST['email'];

    $con = mysqli_connect("host","username","password","database");

    $result = mysqli_query($con, "SELECT * FROM tablename WHERE firstName = '$fname' AND lastName = '$lname' AND emailAddress = '$email'");

    $rows = mysqli_num_rows($result);

    if ($rows > 0) {
    echo "Thank you for logging in, " . $fname . ".<br><br>Please fill out the form below to submit your order.<br><br>";
    // ideally would like to display the form only if this condition is true, but putting the php snippet here does not display the form (echo iphorm(8);)
    }
    else {
    echo "You do not have an account with us, please register first.";
    }

    [/insert_php]

    [iphorm id="8" name="Item List Form"]

    To simplify, I put the form at the bottom of the page instead of inside my if statement, but all it gives me is a huge white space on the page, though it does display the appropriate message from the PHP. Any idea what I’m doing wrong here? I have to have the PHP in this page, is there anyway to display the form only if my first condition is true?

    Thanks-

    #4481
    rubyj
    Participant

    Nevermind, I figured out a solution – I put everything into a custom template and ran it that way and it all works, I even got the form to display if my first condition was true. 🙂

    I do wonder though why the php plugin was interfering.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy