Showing posts with label HTML. Show all posts
Showing posts with label HTML. Show all posts

Thursday, May 3, 2012

HTML Code For Registration Form

Many of the beginners in the world of web developing and design probably sometimes wondered how does the html code for registration form looks like. I will show you an example code, but just having html code is not going to be enough to make your form fully working, but it's a step forward and after all I always recommend step by step learning . You will need to validate the form after the user submit it and notify about possible errors  but I will be covering that topic in some other post. First, if you don't have any hosting make sure you get one so you can host your sites and test them, I recommend this one. Now we will focus on the HTML part.

Here is an example code:


<form action="register.php" id="register" method="post">
<table border="0">
<tbody>

<tr>
<td><label for="name">Your Name*: </label> </td>
<td><input id="name" maxlength="45" name="name" type="text" /> </td>
</tr>

<tr>
<td><label for="email">Email Address*:</label> </td>
<td><input id="email" maxlength="45" name="email" type="text" /></td>
</tr>

<tr>
<td><label for="username">User Name*:</label> </td>
<td><input id="username" maxlength="45" name="username" type="text" /> </td>
</tr>

<tr>
<td><label for="password">Password*:</label></td>
<td><input id="password" maxlength="45" name="password" type="password" /></td>
</tr>

<tr>
<td align="right"><input name="Submit" type="submit" value="Submit" /></td>
</tr>

</tbody></table>
</form>

And here is the result we get with it:



Pretty simple, right? Okay so you noticed that I've inserted my form inside a table. There are also other ways to align form elements, but I love using tables for this, because I find it easy to align elements perfectly by using tables, and it will work in all browsers. What happens here is that we will have separate PHP file that will validate and process our form. You link the form with the php file simply with inserting action="filename.php" inside the opening form tag. This one is just an example for you to see what it looks like when we use the code I wrote above, and it won't work on this site of course. Adding some CSS to this can make it look very nice, but that is the topic that I will be also covering in the coming posts. Feel free to use this code on your websites, you have my full permission. If you have any questions about this html code for registration form just contact me or write a comment to this post and I'll be glad to help you. Thanks for reading and stay tuned for new tutorials, tips, and tricks!