Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: CSS HTML
Hi
 
I am new to CSS and HTML, I want to try and create a registration form where i have a user enter details then submit to a database or if user click on reset it resets the fields.
 
Here is what I have done so far:
 
<html>
<body>
 
	<form tag="Create Logon">
		<div align="center">
			Username *: <input type="username" name="username" />
 
			Password *: <input type="password" name="pwd" />
 
			Surname *: <input type="surname" name="surname" />
 
			Other Names *: <input type="other names" name="names" />
 
			Date of Birth *: <input type="date of birth" name="dob" />
 
			Email *: <input type="email" name="email" />
 
			Telephone: <input type="telephone" name="tel" />
 
			Address *: <input type="address" name="add" />
 
			Post Code *: <input type="postcode" name="ptc" />
 

		<input type="submit" value="Submit" />
		</div>
	</form>
 

<p>Note: Please make sure your details are correct before submitting form and that all fields marked with * are completed!.</p>
 

</body>
</html>
 
Also i want to make sure that the address field is big enough to enter full address in it in multiple lines rather than one long line. If if anyone could help me to align them as well so it looks nice that would be great.
 
Thanks in advance
Posted 21-Nov-11 3:37am
Edited 21-Nov-11 3:38am
v2
Comments
Member 11052044 at 6-Sep-14 8:47am
   
where are the data in goes from the registration page through to the html code in notepad
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

This should get you going in the right direction...
<!doctype html>
<html>
    <head>
        <style type="text/css">
 
            body {font-family:Arial, Sans-Serif;}
 
            #container {width:300px; margin:0 auto;}
 
            /* Nicely lines up the labels. */
            form label {display:inline-block; width:140px;}
 
            /* You could add a class to all the input boxes instead, if you like. That would be safer, and more backwards-compatible */
            form input[type="text"],
            form input[type="password"],
            form input[type="email"] {width:160px;}
 
            form .line {clear:both;}
            form .line.submit {text-align:right;}
 
        </style>
    </head>
    <body>
        <div id="container">
            <form>
                <h1>Create Logon</h1>
                <div class="line"><label for="username">Username *: </label><input type="text" id="username" /></div>
                <div class="line"><label for="pwd">Password *: </label><input type="password" id="pwd" /></div>
                <!-- You may want to consider adding a "confirm" password box also -->
                <div class="line"><label for="surname">Surname *: </label><input type="text" id="surname" /></div>
                <div class="line"><label for="other_names">Other Names *: </label><input type="text" id="names" /></div>
                <div class="line"><label for="dob">Date of Birth *: </label><input type="text" id="dob" /></div>
                <div class="line"><label for="email">Email *: </label><input type="email" id="email" /></div>
                <!-- Valid input types: http://www.w3schools.com/html5/html5_form_input_types.asp -->
                <div class="line"><label for="tel">Telephone: </label><input type="text" id="tel" /></div>
                <div class="line"><label for="add">Address *: </label><input type="text" id="add" /></div>
                <div class="line"><label for="ptc">Post Code *: </label><input type="text" id="ptc" /></div>
                <div class="line submit"><input type="submit" value="Submit" /></div>
 
                <p>Note: Please make sure your details are correct before submitting form and that all fields marked with * are completed!.</p>
            </form>
        </div>
    </body>
</html>
  Permalink  
Comments
Member 10583248 at 9-Feb-14 17:12pm
   
please how can this form be linked to MySql or remote server
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Pls how do i link this code to MYSQL
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 195
1 ProgramFOX 130
2 Maciej Los 105
3 Sergey Alexandrovich Kryukov 85
4 Afzaal Ahmad Zeeshan 82
0 OriginalGriff 6,564
1 Sergey Alexandrovich Kryukov 6,048
2 DamithSL 5,228
3 Manas Bhardwaj 4,717
4 Maciej Los 4,150


Advertise | Privacy | Mobile
Web01 | 2.8.1411022.1 | Last Updated 7 Feb 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100