form/input option in HTML

Discussion in 'HTML & Website Design' started by beirut, Jun 25, 2008.

  1. #1
    Hello. Today I was learning html and to be more specific - 'form' option.
    I have made a form which someone has to fill in and after they press the 'submit' button I will get all the information they have submitted to my e-mail.
    But I don't get any $name, $e-mail, etc information after someone submits the form. Please check my codes

    This is how my .html looks like:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="content-type" content="text/html" />
    </head>
    <body>
    
    <form action="post.php" method="POST" name="form1">
    <br> Name:<br>
    <input type="text" name="name">
    <br> Password:<br>
    <input type="password" name="pass">
    <br> E-Mail:<br>
    <input type="text" name="email">
    <br> Choose your option:<br>
    <input type="radio" name="disc" value="cd"> CD<br>
    <input type="radio" name="disc" value="dvd">DVD<br>
    <br> Choose courses:<br>
    <input type="checkbox" name="ch1" value="yes"> Martial arts<br>
    <input type="checkbox" name="ch2" value="yes"> Drawing courses<br>
    Delivery type:<br>
    <select name="delivery">
    <option> Fast
    <option> Slow
    <option> None
    </select>
    <br> Your address:<br>
    <textarea name="add_text" rows="5" cols="30"></textarea>
    <br>
    <input type="submit" value="yo" />
    
    </form>
    </body>
    </html>
    Code (markup):
    And also my post.php:
    
    <?
    
    if(!isset($ch1)) {$ch1="no";} 
    if(!isset($ch2)) {$ch2="no";} 
    
    mail("thisis@myemail.com", "Feel the rhytm", 
    "Some dude named $name with password $pass and e-mail - $email \n
    Wants $disc of: \n 
    Martial arts  courses - $ch1 \n 
    Drawing courses - $ch2 \n 
    Delivery type - $delivery \n
    Home address - $add_text.");
    
    ?>
    Code (markup):
    After I submit the form I get an e-mail to my mailbox which looks like this:
    [​IMG]

    So I don't get any information. What Am I doing wrong? I guess there is some very simple solution but I can't get to it.
    Thanks!:)
     
    beirut, Jun 25, 2008 IP
  2. q7m

    q7m Well-Known Member

    Messages:
    1,178
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    150
    Digital Goods:
    1
    #2
    In post.php replace $ch1 with $_POST['ch1']. Do the same for all of the form variables.
     
    q7m, Jun 25, 2008 IP