Forums

POST data received when path to PHP file used, not when using URL generated by w (1 post)

  1. julj
    Member
    Posted 1 year ago #

    Hi,

    I've created a page with no content and with a template containing a the form shown below. When using the path to the templates (http://www.exam-vision.com/wp-content/themes/sandbox/test.php) the post data are received as expected, but when using the url generated by wordpress for the page created from this template (http://www.exam-vision.com/testmail), nothing is received. Anybody could help?

    Thanks


    <?php
    echo "POST: ";
    echo var_dump($_POST);
    echo "
    ";
    echo "REQUEST: ";
    echo var_dump($_REQUEST);
    echo "
    ";
    echo "PHP_SELF: ";
    echo $_SERVER['PHP_SELF'];
    if (isset($_REQUEST['email']))
    //if "email" is filled out, send email
    {
    //send email
    echo "isset email is true";
    $email = $_REQUEST['email'] ;
    $subject = $_REQUEST['subject'] ;
    $message = $_REQUEST['message'] ;
    mail( "xxx@gmail.com", "Subject: $subject",
    $message, "From: $email" );
    echo "Thank you for using our mail form";
    }
    else
    //if "email" is not filled out, display the form
    {
    echo "<form method='post' action=''>
    Email: <input name='email' type='text' />
    Subject: <input name='subject' type='text' />
    Message:
    <textarea name='message' rows='15' cols='40'>
    </textarea>
    <input type='submit' />
    </form>";
    }
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic