form help

tonytony ModeratorAdministrator
can anyone help make a form with: name, address, phone number, email address, a few radio button options and a comments bit

cheers

Comments

  • dabossdaboss WP V.I.P. ''The Boss'' Administrator
    tony,

    this should work :) - i've not tested it out though - blind coding. i've excluded the option buttons part as i'm not sure what you want there.

    put this into any web page:
    <form name=contactus action=contactus.php method=post>
      <input size=30 maxlength=30 type=text name=name><br>
      <input size=30 maxlength=30 type=text name=address><br>
      <input size=30 maxlength=30 type=text name=telephone><br>
      <input size=30 maxlength=30 type=text name=email><br>
      <textarea class=forminput name=comments rows=5 cols=40 style="font-family: Courier New; font-size: 10pt"></textarea><br><br>
      <input type=submit value="Submit" name=submit>
    </form>
    


    put this into a page named contactus.php (the name depends on what value you specify for 'action' in the form).
    1. change the email address specified in the mail command to your own email address.
    2. put something into the html part
    <?php
    
    $msg="
    Name: $name
    Address: $address
    Telephone: $telephone
    Email: $email
    
    Comments:
    ========
    $comments";
    
    mail("you@yourdomain.com","Online Query Submission","$msg","From: $email");
    ?>
    
    <html>
    
    <head>
      ...
    </head>
    
    <body>
      ...
    </body>
    
    </html>
    
  • tonytony Moderator Administrator
    thanks for that, it was for a mate of mine that wanted it a bit more advanced than i could do
Sign In or Register to comment.