SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: form

  1. #1
    SitePoint Member
    Join Date
    Oct 2012
    Location
    Chittogong, Bangladesh
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cool form

    How Can I post a registration form by HTML code?

  2. #2
    Grüße aus'm Pott
    SitePoint Award Recipient Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    2,422
    Mentioned
    39 Post(s)
    Tagged
    1 Thread(s)
    Normally you send input from a HTML form back to a server-side script, specified in the form's action attribute.
    The script will then do something with the input it receives, such as store it in a database.
    E.g.
    HTML Code:
    <form action="myScript.php" method="post">
    ...some form stuff here...
    </form>
    How well do you know your JavaScript from your jQuery?
    Check out SitePoint's latest JavaScript challenge


    My blog

  3. #3
    The CSS Clinic is open silver trophybronze trophy
    SitePoint Award Recipient Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    37,763
    Mentioned
    99 Post(s)
    Tagged
    3 Thread(s)

  4. #4
    SitePoint Addict Shaydez's Avatar
    Join Date
    Jul 2006
    Location
    Boca Raton, Florida
    Posts
    311
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    HTML Code:
    <form action="registration.php" method="post">
     <input type='text' name='fname' />
    </form>
    registration.php
    PHP Code:
    mail("your@email.com","The Registration" ,"Submitted by $fname") ; 

    http://www.w3schools.com/php/php_mail.asp
    Sr. Website Developer and Internet Marketing
    www.CarlosJa.com
    Note: If anyone needs to get ahold of me please feel free to email me through my site. Apparently i missed quite a few private messages.

  5. #5
    Hosting Advisor silver trophybronze trophy
    SitePoint Award Recipient cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    2,797
    Mentioned
    44 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Shaydez View Post
    HTML Code:
    <form action="registration.php" method="post">
     <input type='text' name='fname' />
    </form>
    registration.php
    PHP Code:
    mail("your@email.com","The Registration" ,"Submitted by $fname") ; 

    http://www.w3schools.com/php/php_mail.asp
    Whoa! First off, please try not to use w3schools.com for any examples, they are notorious for using insecure examples.

    For example the following problems exist with the code chunk above.
    1. It assumes register globals is enabled, register globals should NEVER be enabled, it is such a security risk the PHP developers eventually removed the feature all together.
    2. It performs no validation, minor as it may be, this is necessary when wanting to prevent XSS and CSRF attacks


    An updated example:
    HTML Code:
    <form action="registration.php" method="post">
     <input type='text' name='fname' />
    </form>
    registration.php
    PHP Code:
    $fname filter_var($_POST['fname'], FILTER_SANITIZE_STRING);
    mail("your@email.com","The Registration" ,"Submitted by $fname") ; 
    You can read more about filter_var on the PHP manual and the type of filters as well.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •