Forums

[resolved] Self submitting form (3 posts)

  1. fgrenier
    Member
    Posted 5 years ago #

    Hello,
    I'm having troubles with custom forms. I'd like my forms to be self-submitting. So that the submission calls the current page but when I submit, I get a 404 error.

    Here is my code

    <?php
    include "http://www.enterpriselearningchina.com/ep_event_functions.php";
    echo "<form id=\"form_visit\" method=\"post\" action=\"".get_permalink()."\">";
    ?>

    This code is in a page with the PHPexec plugin. The URL returned by "get_permalink()" is ok but it looks like my post variables are the problem.

  2. doodlebee
    Member
    Posted 5 years ago #

    I'm not clear on what you're trying to do, exaclty, but I will say this: php includes are not URL driven, they are server driven. Your include path is wrong. Your include is also formatted incorrectly - you're missing characters.

    In other words, the include path has to be relative to your *server*, not your *site*. It shouldn't start with "http://". It should look more like "/home/public_html/ep_event_functions.php"

    In all honesty, you shouldn't have to relate to the server's home path - if your "ep_event_functions.php" resides in the same directory as the form itself, then it just needs to be

    <?php include ('ep_event_functions.php'); ?>

    Hope that gets you started.

  3. fgrenier
    Member
    Posted 5 years ago #

    That's it ! Even if my PHP file was included (I had an output from it) the variables were not available. But now it's ok.
    One important thing, don't use "name" for the name field because the $_POST['name'] variable seems to be already used by WordPress and it makes the page crash.

    Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic