View Full Version : PHP Alignment
Employment Law Clinic
2nd October 2009, 18:36
Hi,
Having heard a lot of positive stuff about it, I took some time out this afternoon to learn a little bit about PHP. I've managed to get something basic functioning on a test page, but I'm struggling to get the entry boxes aligned tidily while still keeping the page W3 compliant.
The code looks like:
<div><label for="name">Name:
<input type="text" size="30" name="name" id="name"/></label></div>
<div><label for="company">Company:
<input type="text" size="30" name="company" id="company"/></label></div>
<div><label for="email">E-mail Address:
<input type="text" size="30" name="email" id="email"/></label></div>
<div><label for="phone">Phone Number:
<input type="text" size="30" name="phone" id="phone"/></label></div>
but at the moment the boxes all align next to the text on the left of the page, so look quite untidy in the live page - http://employmentlawclinic.com/underconstruction/draftpage.php.
Can anyone give me some CSS or other coding tips to get these aligned? If it matters, the page is written in XHTML 1.0.
Thanks,
Karl Limpert
Employment Law Clinic
2nd October 2009, 21:49
Ok, I seem to have cracked it - something about tables (not coding I've used before), so subject to testing in various browsers, hopefully we can find a way to make efficient use of this new knowledge, and have some PHP options on the site in the future.
Karl Limpert
Chunkford
2nd October 2009, 22:34
If you are wanting to learn try w3schools as a start. If you want a book, have a look at the head first books from O'Reilly. It can be a fun way to learn subjects that can be overwhelming.
BTW cross browser testing is where the fun starts ;)
Good luck
Employment Law Clinic
2nd October 2009, 22:55
Thanks for the tips Sir Chunk. I can never seem to make much sense of what W3 have in their schools though, and only wanted to learn something quick for now - only had an afternoon to do this; already got loads to read & write; and still learning HTML & CSS in my spare time; so only dabble in JavaScript... and now php :) - but found a draft chapter from an e-book that helped.
Checked so far in IE6 to IE8 & Chrome, which appear fine; I'll check Firefox, Opera, and Safari shortly, but hopeful at this stage.
Karl Limpert
dots and spots Jeff
3rd October 2009, 11:12
Karl
I can't help you with your original problem (although it seems you may have solved it yourself), but if your interested in learning HTML/CSS javascript PHP etc you might be interested in 'my story' - how I learnt about some of the above.
A little over a year ago, my wife set up her own business (dots and spots) and felt she needed a website. She was quoted between £1k & £2k for a website - money we didn't have! - so I went out and bought a book: "Sam's Teach yourself HTML & CSS" and built her a website. I can certainly recommend this book (and others in the 'Sam's Teach yourself' series). I enjoyed building the website and felt I wanted to learn more so I enrolled on a 12 week Open University course: Web Applications: Design, Development and Management (course code TT280) - I knew some HTML & CSS starting this course, but it taught me a lot more, got rid of a lot of bad habits and I now surprise myself as to how quickly I can bash together a website!
I then went on to do the next 12 week course (TT281) which taught (amongst other things) javascript and the third course in the series has just begun. If I complete all 6 12-week courses (on of which focuses on PHP) I gain a 'Certificate in Web Applications' from the OU and can put letters after my name!!
The courses are hard work - I work full time - but it is a good series of courses and I'm learning a huge amount!
Jeff
Employment Law Clinic
3rd October 2009, 11:46
Hi Jeff,
Thanks for the advice. My story is similar, as I had tried WYSIWYG sites, but found I didn't have the control I wanted over them, so about 18 months ago bought a book from SitePoint, by Ian Lloyd (would recommend these too). Hadn't done any programming in over 20 years (old days of Assembly, machine code, and other ghastly languages), and a mental block meant I just could not figure out where to start - where to actually write the code (equally had never seen a useful purpose for Notepad)! The penny dropped one day, and a couple of days later I had a functioning site; I'm sure the code wasn't (and still isn't) tidy or efficient, but it passed the W3 standards which I gather means something positive.
The better half is in the final year of some Computer Science degree course, and she can quickly scan a page, noticing a missing or misplaced division, etc, and she also knows her way around Java too, but not PHP at the moment. I figured I should try to find out a bit about it, but not something I want to spend time on or learn intensely at the moment - law keeps me busy enough to not want to learn this stuff in detail, but useful to be able to know the basics for when you want to change something or do something new.
As I do enjoy it as a pastime, perhaps I will look into those recommendations one of these days though. Can't do any harm, and will perhaps open up a whole new world of possibilities....
Karl Limpert