Home › Forums › Quform WordPress › form not showing up on page with PHP
- This topic has 1 reply, 1 voice, and was last updated 11 years, 6 months ago by rubyj.
- AuthorPosts
- May 20, 2013 at 8:25 pm #4479rubyjParticipant
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-
May 20, 2013 at 9:14 pm #4481rubyjParticipantNevermind, 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.
- AuthorPosts
- You must be logged in to reply to this topic.