HenryCan Posted January 31, 2013 Share Posted January 31, 2013 I'm nearly finished writing my first php programs. (I've got experience writing code in other languages, including Java, but this is my first PHP code.) They are basically forms that the user completes to propose meeting topics of different kinds for the bookclub to which I belong. My code uses JQuery's validate plugin to check the data on the client side, then uses php to re-validate the code on the server side, in the event that the user has Javascript turned off in their browser. If the validations on both sides are successful, a row is inserted into a MySQL table. All of this works pretty much perfectly, although I haven't tested all that thoroughly yet. (I've got one issue re apostrophes that I've posted about separately.) Since these are my first programs in an unfamiliar language, I'm not at all sure that I'm doing everything the best possible way. I'm especially concerned that I may not be structuring the HTML, JQuery validations and php code the way they should be done. I would love to post my code here and get the equivalent of a code walkthru with suggestions on what I need to do to make my program the best it can be. Is that acceptable within the culture of this forum? This is strictly a spare-time/hobby effort and I have no peer group to review this code for me. These are my first uses of JQuery and PHP in any setting. I'm just looking for informal comments on what I'm doing wrong and how to make the code better. I know from other languages that you can write code that compiles and executes and does what it is supposed to do but still have really awful code. I'd like to see what needs to be done to get my structure and style up to professional standards. So, would it be okay for me to post one of my programs here for your comments? I assure you that it is NOT a lengthy program with thousands of lines of code. There are just three files: the first contains the HTML for the form and the JQuery validations and is presently 109 lines. The second is my php code which does the server side validations; it's presently 114 lines. The third is a trivial HTML file that basically thanks the user for inputting a suggesting and helps him navigate a bit; it is just 15 lines. Quote Link to comment https://forums.phpfreaks.com/topic/273879-form-validation/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.