Jump to content

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/273879-form-validation/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.