allowing users to make feedback comments

  • 18 years ago

    i want to add the possibility to users to add comments to certain sections in my webpage, ans i would like to know if anyone could help me and tell how to make it with php. thanks.

  • 18 years ago

    well, you just make your form in HTML like this:


    Code:
    <form action="email.php" method="post">
    Your name: <input type="text" name="name" size="40"><br>
    Your email address: <input type=text name="email" size=40><br>
    Your feedback:
    <textarea name="feedback" rows="5" cols="30">
    </textarea>
    <br>
    <input type="submit" value="Send feedback">
    </form>
    </body>
    </html>


    and email.php is like this:


    Code:
    <?
      $to = "hello@something.com";
      $subject = "Hello!";
      $message = "Name: ".$name."\nEmail: ".$email."\nComments: \n".$feedback."\n";
      $from = "me@you.her";


      mail($to, $subject, $message, $from);
    ?>



    (notice that the variables used in PHP are the names you gave the inputs in the HTML


    hope that helps


    (*edited cos i accidentially deleted the <form> tag...whoops!)

  • 18 years ago

    the fact is, i would like the comments to appear directly in a popup window...
    i didn't explain myself very good i'm sorry

  • 18 years ago

    well the variables used in the script below can just be echoed to the browser like this:


    echo "Name: ".$name."\nEmail: ".$email."\nComments: \n".$feedback."\n";

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.” - Antoine de Saint Exupéry