473,385 Members | 1,531 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

how to get correct alignment i

18
how to get align textbox correctly in form page of php
this is the code i executed

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <body>
  3. <form action="welcome.php" method="post">
  4. Name:<input type="/t text" name="fname" /></br></br>
  5. Age     :<input type="/t text" name="age" /></br></br>
  6. Email:<input type="/t text" name="email"/></br></br>
  7. <input type="submit" />
  8. </form>
  9. </body>
  10. </html>
Jan 6 '10 #1
7 1761
Atli
5,058 Expert 4TB
Hi.

You would want to start by validating the HTML. There are a few things wrong with that markup that cause it to be displayed incorrectly:
  1. The DOCTYPE is missing. All HTML and XHTML pages require a doctype, so the browser knows what sort of markup it is supposed to use.
  2. You are missing the <head> tag, as well as a <title> tag. (You should also include a <meta> tag to set the content-type, but that is not required.)
  3. "/t text" is not a valid value for the <input type> attribute. You probably meant to use "text".
  4. Your </br> tags are incorrect. They should be either <br> (HTML) or <br /> (XHTML).

Once you have fixed that, if you want to align the boxes properly, you should try using CSS.

For example, if you change your form to look like this:
Expand|Select|Wrap|Line Numbers
  1. <form action="welcome.php" method="post">
  2.     <label>Name:</label><input type="text" name="fname"><br>
  3.     <label>Age:</label><input type="text" name="age"><br>
  4.     <label>Email:</label><input type="text" name="email"><br>
  5.     <input type="submit">
  6. </form>
  7.  
You could add CSS rules to the <header> section to make the <label> tags equally wide, thus aligning the input boxes.
Expand|Select|Wrap|Line Numbers
  1. <style type="text/css">
  2.     label {
  3.         display: inline-block;
  4.         width: 75px;
  5.         text-align: right;
  6.     }
  7. </style>
  8.  
Jan 6 '10 #2
Dormilich
8,658 Expert Mod 8TB
You could add CSS rules to the <header> section
an external CSS file would also work.

note on labels:
you can explicitly assign a label to a certain form control. most browser then focus the form control, when you click on its label.
Expand|Select|Wrap|Line Numbers
  1. <label for="test">text</label>
  2. <input type="text" id="test" … >
Jan 6 '10 #3
Markus
6,050 Expert 4TB
Please post your questions to the correct forum. This is clearly an HTML problem. Therefore, this question would be posted to the http://bytes.com/topic/html-css/answers forum. I will it there now.

Moderator.
Jan 6 '10 #4
drhowarddrfine
7,435 Expert 4TB
The /t was probably meant as a tab but that's wrong anyway and should be \t.

Factoid: html, body and head tags are optional in html.
Jan 6 '10 #5
Atli
5,058 Expert 4TB
@drhowarddrfine
Are you sure about that?
I can't seem to get either strict or transitional to validate without <html>, <head>, <title> and <body> tags.

HTML5 seems fine with it at the moment, though.
Jan 6 '10 #6
Dormilich
8,658 Expert Mod 8TB
that means: although it is not valid, it works somehow without those.
HTML5 seems fine with it at the moment, though.
have you looked at the HTML5 DTD?
Jan 6 '10 #7
drhowarddrfine
7,435 Expert 4TB
Are you sure about that?
I can't seem to get either strict or transitional to validate without <html>, <head>, <title> and <body> tags.
<title> is required but none of the others are. Never have been.
Index of Elements
Jan 6 '10 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Philip Meyer | last post by:
1) setting image as Background with alignment in center not working..help Explanation : i need to set a image as background and also it should be dispalyed in the center.i am using apache fop...
4
by: Shashi | last post by:
Can somebody explain how the byte alignment for structures work, taking the following example and considering: byte of 1 Byte word of 2 Bytes dword of 4 Bytes typedef struct { byte a; word...
67
by: S.Tobias | last post by:
I would like to check if I understand the following excerpt correctly: 6.2.5#26 (Types): All pointers to structure types shall have the same representation and alignment requirements as each...
102
by: Skybuck Flying | last post by:
Sometime ago on the comp.lang.c, I saw a teacher's post asking why C compilers produce so many error messages as soon as a closing bracket is missing. The response was simply because the compiler...
13
by: aegis | last post by:
The following was mentioned by Eric Sosman from http://groups.google.com/group/comp.lang.c/msg/b696b28f59b9dac4?dmode=source "The alignment requirement for any type T must be a divisor of...
24
by: temper3243 | last post by:
Hi, Many people have used this code in my project. It works because b is using the extra memory for other 4 variables.I access obj max. well here are a few questions 1) Where does it fail. I...
12
by: Yevgen Muntyan | last post by:
Hey, Consider the following code: #include <stdlib.h> #define MAGIC_NUMBER 64 void *my_malloc (size_t n) { char *result = malloc (n + MAGIC_NUMBER);
10
by: haomiao | last post by:
I want to implement a common list that can cantain any type of data, so I declare the list as (briefly) --------------------------------------- struct list { int data_size; int node_num;...
27
by: pamela fluente | last post by:
Hello, for the following code, VS suggests that construct (width= height= ) is out of date and a newer one is recommended: <table><tr><td width="92" height="38" valign="middle">AnyThing</td></...
2
by: somenath | last post by:
Hi All, I have one question regarding the alignment of pointer returned by malloc. In K&R2 page number 186 one union is used to enforce the alignment as mentioned bellow. typedef long...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.