WordPress.org

Ready to get started?Download WordPress

Forums

PHP Code for posts
Problem with using a form (2 posts)

  1. iharald112
    Member
    Posted 5 months ago #

    Hi,

    great plugin which fulfills (nearly) all my requirements.

    If I try to create a form (input field) I am not able to use the information entered by the user on the target page (which is defined in the <form> section ("action="...") as the information entered is not available in the variable specified in the <input> section.

    I learned that a predefined object can be used to exchange data between snippets ($PHPPC ...) (and posts?) but this does not work with a form - or am I wrong?

    I would appreciate it if there is a solution for this problem ...

    Thx,
    Harald

    https://wordpress.org/plugins/php-code-for-posts/

  2. battingboy90
    Member
    Posted 5 months ago #

    I am having some troubles using a form with this plugin as well. My form will not show up. here is my code:

    <?php

    $action=$_REQUEST['action'];

    if ($action=="") /* display the contact form */
    {

    ?>

    <form action="" method="POST" enctype="multipart/form-data">
    <input type="hidden" name="action" value="submit">
    Your name:
    <input name="name" type="text" value="" size="30"/>
    Your email:
    <input name="email" type="text" value="" size="30"/>
    Your message:
    <textarea name="message" rows="7" cols="30"></textarea>
    <input type="submit" value="Send email"/>
    </form>

    ?>
    <?php

    }
    else{
    $name=$_REQUEST['name'];
    $email=$_REQUEST['email'];
    $message=$_REQUEST['message'];
    if (($name=="")||($email=="")||($message==""))
    {
    echo "All fields are required, please fill the form again.";
    }
    else{
    $from="From: $name<$email>\r\nReturn-path: $email";
    $subject="Message sent using your contact form";
    mail("battingboy90@aol.com", $subject, $message, $from);
    echo "Email sent!";
    }

    }

    ?>

    Any help is appreciated!

Reply

You must log in to post.

About this Plugin

About this Topic