#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2000
    Location
    canada
    Posts
    2
    Rep Power
    0
    Hi,
    I'm new to PHP and I'm trying an example from a book. This example is a small application that takes the output from a form and generates an e-mail message containing the form's contents. This is called Ex5.html :

    <html>
    <head><title>Example #5</title></head>
    <body>
    <form method=POST action=example_5.php3>
    EMail Address:<INPUT TYPE=TEXT NAME="email_address"><br>
    Phone Number: <INPUT TYPE=TEXT NAME="phone_number<br>
    <INPUT TYPE=SUBMIT NAME=SUBMIT>
    </form>
    </body>
    </html>

    -----------------------------------
    and this is called example_5.php3 :
    -----------------------------------

    <?PHP

    $message = sprintf("Form data -----------------n");

    while(list($key, $val) = each($HTTP_POST_VARS)) {
    $message .= sprintf(#34>[%s]: %sn", $key, $value);
    }

    $message .= "n";
    $message .= "More Information ------------------n");
    $message .= "The user's IP address is";
    $message .= getenv("remote_addr").".n";
    $message .= "The user is running the web browser ";
    $message .= getenv("http_user_agent").".n";

    mail("bijanbel@excite.com", "Feedback Form", $message, "
    From: Feedback someone@hotmail.com" );

    ?>
    to invoke this I go to the html file with
    my browser I fill out the form and submit.
    then I get the following error messages :

    Warning: Variable passed to each() is not an array or object in
    /home/httpd/html/tests/example_5.php3 on line 5
    ------------------------------------
    Warning: Unexpected character in input: '' (ASCII=92) state=1 in
    /home/httpd/html/tests/example_5.php3 on line 6
    -------------------------------------
    Parse error: parse error, expecting `')'' in /home/httpd/html/sheilabel/tests/example_5.php3 on line 7
    ------------

    >>> Does anyone have any idea how to fix this ? Some how it is not recognizing $HTTP_POST_VARS as an array but why I don't know.
    >>> Please help. Thanx
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2000
    Posts
    33
    Rep Power
    15
    hi i'm a newbie, but
    it looks like this is what's wrong on line 6$message .= "More Information ------------------n");

    remove the ) before ;
    and i think the problem is solved

    good luck,

    Jan, the Netherlands.

Similar Threads

  1. HELP! PHP - Mime email attachment problems
    By Jbafia in forum PHP Development
    Replies: 7
    Last Post: January 8th, 2005, 02:46 PM
  2. How to create HTML email with PHP?
    By bubbapuck in forum PHP Development
    Replies: 4
    Last Post: March 8th, 2004, 07:48 PM
  3. article on hiding email from miners using php?
    By Mystic511 in forum Development Articles
    Replies: 1
    Last Post: February 20th, 2004, 05:47 AM
  4. need help with my first PHP email form
    By dandcp in forum PHP Development
    Replies: 9
    Last Post: February 16th, 2004, 10:32 AM
  5. sending email + multiple attachments using php
    By gbow in forum PHP Development
    Replies: 6
    Last Post: February 13th, 2004, 10:31 AM

IMN logo majestic logo threadwatch logo seochat tools logo