How to Build an Advanced HTML Form Using PHP and MySQL




Get the source code here: http://www.johnmorrisonline.com/lesson/build-advanced-html-form-using-php-mysql/ In this lesson, you’ll learn how to build a kick ass …

source


32 responses to “How to Build an Advanced HTML Form Using PHP and MySQL”

  1. hi john, what if I only want certain fields to go to certain tables? for example if I want the student info to go into a student table, then their class info to go in the class table, all submitted on the same form.

  2. Hi John, I've been trying to teach myself programming for a while now. I'm actually a full time psychologist, so the programming is more of a hobby that I do in my spare time. Anyway, I really like your tutorial. However, one question I can't seem to find an answer to is reloading form selections back into a form. So the idea would be that I could have a rather large form tied to a users name (patient's name in my case) and save their selections if they don't finish, then reload their selections again in the next session to allow them to finish. I was wondering if you could make a tutorial showing that process or direct me in some direction that shows it. I've been looking for a long time and really just not finding anything of value.

  3. Sorry got another question…: I googled and got that $_POST array gets values from HTTP POST method. In your form.php, you have <input type="hidden" name="formID" value="form2"> without explicitly defining the method, and I also got from w3c that the default method is GET. Then, how could this table name be passed to $table = $_POST['formID'] without defining method = 'POST'?

    Thanks for the help!

  4. Another noob question: In your f_sqlConnect() function I didn't see a return statement inside of it, then how could you make $link= f_sqlConnect(blablabla) in your process.php? Does this $link "take" out the value of the local var $link inside of f_sqlConnect()?

    Thanks

  5. Had been struggling for sometime with connecting with a database with php and you really helped me a lot. Great tutorials.

    I had to tweak though some code due to mysqli.

  6. Awesome series. Everything I needed to fill the holes of my learning. Could you show the snipit for doing an UPDATE. (query read, change a field data, update). I've seen other examples but not in an array fashion. Thanks.

  7. I tried the code and it worked with no error but its not taking value from the user. I'm not getting whats wrong with my code.

    "You are not allowed to submit data to this form" this message is displayed after submission of form, any suggestions to get it correct ?

  8. Okay, there is definitely something buggy here. It just can't create a table over 19 entries (not counting the ID, timestamp, etc.) without smashing you over the head with error messages. It's either a fault with my localhost software (or its components) or some issue in the code…

    Sod this fancy automated stuff, I'm going to create the tables manually. Life is too short to waste it debugging when there's a simpler way to get the end result.

  9. Great tutorial, though clearly not for the novice, that's for sure. A real oddity for me when using the dynamic form code is everything works like a charm as long as I don't go above 19 fields. If I use 20+ fields, it still creates and populates the database table, but dishes out a host of undefined index and undefined constant alter errors rather than redirecting to my success page… Will have "fun" digging into the reasons for that.

  10. Hey John, this has been a really great tutorial and I love the concept of being able to create table items from the HTML. When I applied your code to my contact page I keep receiving the "You are not allowed to submit data to this form" error message. I was wondering what your thoughts on this might be. there must be something up on my end with the if ($domain == $r_domain) portion.

  11. Hi, I've a problem, when I click the submit, it returns me "The reCAPTCHA wasn't entered correctly. Go back and try it again.(reCAPTCHA said: incorrect-captcha-sol)". How can I configure recaptcha in the code?
    Thank you for this tutorial, it is very helpful.

Leave a Reply