Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

php variables passing issue

  • 01-11-2005 9:48pm
    #1
    Registered Users, Registered Users 2 Posts: 528 ✭✭✭


    Hi all,

    Anyone can tell me why I get an error message "Notice: Undefined variable: comments in C:\Inetpub\wwwroot\test\do.php on line 9"

    Here is the code :

    form.htm:

    <html>
    <body>
    <form action="do.php" method="post">
    username: <input type="text" name="username"><br>
    address: <input type="text" name="useraddr"><br>
    <textarea name="comments"></textarea>
    <input type="submit" value="Do">
    </form>
    </body>
    </html>

    do.php:

    <?php
    #recipient's email address
    $to = "me@yahoo.com";#here I enter my email

    #Subj
    $re ="Website Feedback";

    #message from the form
    $msg=$comments;

    #send now
    mail($to,$re,$msg);
    ?>

    <html><body>
    thanks!<br>
    </body>
    </html>


Comments

  • Registered Users, Registered Users 2 Posts: 5,335 ✭✭✭Cake Fiend


    Global vars are most likely turned off. Use the superglobal $_POST array (google it if you don't know what it is).


  • Registered Users, Registered Users 2 Posts: 528 ✭✭✭Drexl Spivey


    Bingo!

    I replace $comments with $_POST["comments"]

    Thanks! :)


Advertisement