WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Application form (3 posts)

  1. Enigma
    Member
    Posted 8 years ago #

    I need to find out where my unofficial rival blog (Fresh Politics) has found a plugin for this http://freshpolitics.us/application.php . I have wp-contact plugin by Ryan Duff, Firas Durri but I need mine like Fresh politics.....Any suggestions?

  2. skippy
    Member
    Posted 8 years ago #

    Probably not a plugin at all, but simple PHP form. I use something similar on my "contact" page:
    <form method="POST" action="/blog/contact-form.php">
    Name:
    <input type="text" name="name" size="50"/>
    Email:
    <input type="text" name="email" size="50"/>
    Comment:
    <textarea name="message" rows="10" cols="50"></textarea>
    <input type="submit" name="Send" value="send"/>
    </form>

    Then contact-form.php handles the actual submission, and properly deals with errors:

    <?php
    require_once('./wp-blog-header.php');
    $error = "";
    $name = (isset($_POST['name'])) ? $_POST['name'] : '';
    $email = (isset($_POST['email'])) ? $_POST['email'] : '';
    if ('' == $name) {
    $error = "You need to supply a name!";
    } elseif ( ('' == $email) || (! is_email($email)) ){
    $error = "You need to supply a valid email address!";
    } elseif ('' == $_POST['message']) {
    $error = "You didn't say anything!";
    }
    if ('' == $error) {
    $headers = 'From: "' . $name . '" <' . $email . '>';
    mail('skippy@skippy.net', 'Message for you, sir!', stripslashes($_POST['message']), $headers);
    }
    // now we say thanks, or explain the error message
    get_header();
    get_sidebar();
    echo "<div id='content' class='narrowcolumn'><div class='post'>";
    if ('' != $error) {
    echo "<h3 class='storytitle'>Whoops!</h3>";
    echo "There seems to have been an error with your submission:
    ";
    echo "<p style='color: #B84A00; text-align: center;'>" . $error . "
    ";
    echo "Would you care to try again?
    ";
    } else {
    echo "<h3 class='storytitle'>Thanks!</h3>";
    echo "Your message has been sent. I'll read it just as soon as I can.
    ";
    }
    echo "</div></div>";
    get_footer();
    ?>

    It should be trivial to expand the above to include the details you require.

  3. Enigma
    Member
    Posted 8 years ago #

    Thank you so much. Appreciated. :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.