Hey there.
I'm going to open myself up to a world of pain, but it's the only way I'm going to learn!
I taught myself php from a book, online tutorials, and not a little help from some of you fine folks in here.
The problem is I know I'm still writing code too 'line by line' - functions and objects still baffle me.
What I'd appreciate here, if you'd oblige, is a critique of this code - it's fairly typical of the way I work. I'm pretty sure functions should be used here, but to be honest I don't know why - most functions I see simply appear to increase the amount of code that needs writing!
Background to this page:
It's part of a small-ish web-app I'm writing for a publisher to help with their workflow and bibliographic data storage. This is one page of about 8 that I'm re-writing/designing. It's a form containing a dozen or so fields pertaining to a given title. It will be operating in a controlled environment (i.e. an office with known hardware/software).
Basic operation:
User loads page. All fields are readonly/disabled
User clicks 'edit' button. readonly/disabled fields are toggled to enabled via jquery
For <select> dropdowns I display the current option in a <input> that is disabled. When the user clicks 'edit' it performs an ajax query to load and populate the <select>.
User makes edits as required. Clicks 'Save'.
Form is submitted, values written to database, page is reloaded with new values.
I'd also appreciate any advice you can offer on form validation - at the moment I'm only checking to see that the mandatory fields have a value. I'm reading around the subject at the moment and I'm totally confused, but I think that's a question for the 'newbie help' section of the site - but any tips in here would be gratefully received too.
Thanks in advance (and please be at least a little bit gentle!)