How Can I post a registration form by HTML code?
| SitePoint Sponsor |
How Can I post a registration form by HTML code?

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


If you want a simple form to email script then there are plenty of ready made scripts about.
www.pmob.co.uk CSS FAQ 3 col demo Read My CSS Articles
Ultimate CSS Reference
Check out SitePoint's latest JavaScript challenge


registration.phpHTML Code:<form action="registration.php" method="post"> <input type='text' name='fname' /> </form>
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.


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.
- 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.
- It performs no validation, minor as it may be, this is necessary when wanting to prevent XSS and CSRF attacks
An updated example:
registration.phpHTML Code:<form action="registration.php" method="post"> <input type='text' name='fname' /> </form>
You can read more about filter_var on the PHP manual and the type of filters as well.PHP Code:$fname = filter_var($_POST['fname'], FILTER_SANITIZE_STRING);
mail("your@email.com","The Registration" ,"Submitted by $fname") ;
Bookmarks