Discussion in 'Coding Help' started by, Mar 20, 2006.

  1. New Member

    hi all..

    they have puzzeled me for long enough.. and now i want to learn...

    i have a few q's.

    1. how do i set up a form... well i use dreamweaver and front page
    2. what do i have to type into the code
    3. what do i submit the stuff that people fill in to. (ie. to an email address or to a text file .txt or something else)
    4. if i was using a form for a links page how do i get the results to appear on the site?

    many thanks to anyone who can help
  2. louie

    louie New Member

    you are missing the most important part.
    what language do you use asp or php?

    forget about frontpage stick with dreamweaver.
    both of them has the capabilities of helping you creating the form itself.

    for the last question we need an answer to the first question i asked.
    on both language you can use the request mode depending on the setup of the form post or get.

    you need to decide what you want to do with the form itself - email it or save to a database or probably a text file(don't see the point in that)
  3. New Member

    php all the way as i am on a linux server.

    secondly i am totally new to this so i dont mind weather i use a database txt file for email..

    i just want to make a working form first of all.. start with something basic to practice and then slowly develop it
  4. louie

    louie New Member

    forms are the most complicated thing cause they need to be checked and rechecked especially if you do an insert in the database.
    using the post method you can get the field value in php by using
    <?php @$HTTP_POST_VARS['youformfieldname'];?>

    if using get (not recommend it)
    <?php @$HTTP_GET_VARS['youformfieldname'];?>

    hope this help
  5. New Member

    <?php @$HTTP_POST_VARS['feedback.txt'];?>
        <input type="text" name="textfield">
        <textarea name="textarea"></textarea>
        <input type="submit" name="Submit" value="Submit">

    is that it??? sorry i am very at see with these forms!
  6. mneylon

    mneylon Administrator Staff Member

    What are you going to use the forms for?
    Is it to gather information?
    A replacement for a mailto: link?
  7. louie

    louie New Member

    you can not asle for a text file from you form but a textfield by name or id.
    [COLOR=#000080]<?php @$HTTP_POST_VARS['[COLOR=#0000ff]textfield[/COLOR]'];?>[/COLOR]
    [COLOR=#000080]<form method="post" action="" name="form1">[/COLOR]
        [COLOR=#ff8000]<input type=[COLOR=#0000ff]"text"[/COLOR] name=[COLOR=#0000ff]"textfield" value="[COLOR=#000080]<?php echo @$HTTP_POST_VARS['[/COLOR][COLOR=#0000ff]textfield[/COLOR][/COLOR][COLOR=#000080]'];?>"[/COLOR]>[/COLOR]
        [COLOR=#ff8000]<textarea name=[COLOR=#0000ff]"textarea"[/COLOR]>[/COLOR][COLOR=#ff8000]</textarea>[/COLOR]
        [COLOR=#ff8000]<input type=[COLOR=#0000ff]"submit"[/COLOR] name=[COLOR=#0000ff]"Submit"[/COLOR] value=[COLOR=#0000ff]"Submit"[/COLOR]>[/COLOR]
  8. New Member

    initially yes but i have never successfully used forms so i just want to get one to work and then try and slowly develop it to such an extent that i can make forms to add stuff to websites. Similar to php nuke websites or forums and the like.
  9. New Member

    so is there anyone that would be so kind as to make a small bit of code for a email feedback form and what to do to get it to work.


    thats it.

    many many thanks
  10. louie

    louie New Member

    // ------------- CONFIGURABLE SECTION ------------------------
    // $mailto - set to the email address you want the form
    // sent to, eg
    //$mailto  = "[EMAIL=""][/EMAIL]" ;
    $mailto = [EMAIL="''"]''[/EMAIL] ;
    // $subject - set to the Subject line of the email, eg
    //$subject = "Feedback Form" ;
    $subject = "Feedback Form" ;
    // the pages to be displayed, eg
    //$formurl  = "[URL=""][/URL]" ;
    //$errorurl  = "[URL=""][/URL]" ;
    //$thankyouurl = "[URL=""][/URL]" ;
    $formurl = "[URL=""][/URL]" ;
    $errorurl = "[URL=""][/URL]" ;
    $thankyouurl = "[URL=""][/URL]" ;
    $uself = 1;
    // -------------------- END OF CONFIGURABLE SECTION ---------------
    $headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;
    $name = $_POST['name'] ;
    $email = $_POST['email'] ;
    $comments = $_POST['comments'] ;
    $http_referrer = getenv( "HTTP_REFERER" );
    if (!isset($_POST['email'])) {
     header( "Location: $formurl" );
     exit ;
    if (empty($name) || empty($email) || empty($comments)) {
       header( "Location: $errorurl" );
       exit ;
    if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) {
     header( "Location: $errorurl" );
     exit ;
    if (get_magic_quotes_gpc()) {
     $comments = stripslashes( $comments );
    $messageproper =
     "This message was sent from:\n" .
     "$http_referrer\n" .
     "------------------------------------------------------------\n" .
     "Name of sender: $name\n" .
     "Email of sender: $email\n" .
     "------------------------- COMMENTS -------------------------\n\n" .
     $comments .
     "\n\n------------------------------------------------------------\n" ;
    mail($mailto, $subject, $messageproper,
     "From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.07" );
    header( "Location: $thankyouurl" );
    exit ;
    <form action="feedback.php" method="post">
    <table border="0" cellpadding="8" cellspacing="8" summary="feedback form">
    <tr><td>Name:</td><td><input type="text" name="name" size="25" /></td></tr>
    <tr><td>Email address:</td><td><input type="text" name="email" size="25" /></td></tr>
    <td colspan="2">
    Comments<br />
    <textarea rows="15" cols="45" name="comments"></textarea>
    <td align="center" colspan="2">
    <input type="submit" value="Send Feedback" /><br />
  11. louie

    louie New Member

    Is nice to hear if that code worked alright for you.
  12. New Member

    ya sorry man i have been ultra busy i havent really had time to look back here!! but tried that and its great. many thanks

Share This Page