tryharder has asked for the wisdom of the Perl Monks concerning the following question:

I am new to PERL and CGI, as well as this forum, so please bear with me. I'm having trouble with a project I have in a Web class. I have an HTML form for visitors to fill out. On submitting, it calls a cgi script to parse the text input , put it into a table, and reply with a confirmation response displaying the table and a link back to the form or home page. All this works. However, I need to incorporate a script to parse and store the input to a database, and a script to check the name and password input against this database to 1)determines if the visitor submitted before (Welcome Back, here's your record) or 2) it's a new submit, giving the confirmation response (Thank you, here is your input). I'm working on the response if it is a new submit but the visitor forgot the password, to send an email providing them with the password. But, this will be based on creating the database of previous input. So, can any wise masters guide me on my quest for knowledge? I'm sure it would help to see what I have so far, in order to assist. I can send the HTML files and script I have to anyone who has the patience and time to help tutor me. Thank you for any consideration.

Replies are listed 'Best First'.
Re: Parse form data to database
by jdtoronto (Prior) on May 12, 2006 at 16:38 UTC
      Thank you for the good wisdom. I will investigate this link and appreciate the input.
Re: Parse form data to database
by leocharre (Priest) on May 12, 2006 at 17:43 UTC

    Well tryharder, there are a million ways to do this. And I think also wise to point out, there are a million levels on which you can do this- that is.. how far you can take it. how deep this works.. How secure, etc.

    What you describe can be done in a few hours, or a few weeks. It depends on how far you want it to 'work'. This *is* for educational purposes - right? So.. I'm not sure- if this is for educational purposes, should you do this/be shown how.. minimally? so it works.. or what some others here would call 'looks like it works but is really broken'- ..

    Or maybe.. since this is for a class- it should be a real world example- complete with taint checking... maybe email checking.. etc etc.

    tryharder, you will have to honeslty ask yourself- do you just want to pass this class- or are you learning to code. Because, if you are learning to code for real,I think this should take you many many many days to do. A ton of stuff to learn.

    If you are just passing your class- And there is absolutely nothing wrong with that! It can take you a lot less time. I don't know the rigurousness and strictness of your instructor.

    Regardless; - I would suggest:

    • work on each thing separately! Solve each problem almost isolated from the others. If you don't- you will go insane.
    • These types of things: user creation, user validation (do they log in to make a comment?), user forgot password retrieval regeneration and response, the form input accept script (maybe even a whole chunk just devoted to making sure the submitted data isn't funny.--- ) - all these things should be looked at isolated from each other, as if each was one sepparate class assignment.. how to save user input to a flat text file, how to record to a db table.. how to generate a password.. (using apache basic validation might be a good idea here somewhere.. )
    • read up ovid's cgi course as suggested - this is a wonderful incredible tutorial, this guy is adorable for having written that and shared it with everyone.

    Those are some basic things. Also, why don't you post a url to your stuff? maybe a place where your code can be seen.. Basically.. this whole thing is pretty involved and complex. You don't usually get people coming here and saying "tell me how would i make a website?" -- hahah.. but that is a little bit what you are asking here.. it's too vague. People, tend to do more of.. asking on specific things when they run into problems. So... Take your project appart piece by piece first and ask questions on perlmonks as problems arise.. you will be astonished with the ammount of good energy and help you will receive here.- Be more specific.

      Thank you for the great response. Yes, I am trying to pass the class, and eventually might delve deeper into coding. This Web design course was a prerequisite for my program. I do find it interesting and challenging, but had no real intent to get so deep into scripting. I'll check the link provided for clues on what I can do further.

        Ahh.. yeah.. oh dear. Yeah man, coding's not for everyone. It's a choice.. And this whole thing..
        it's not exaclty a "and next week we start studying for the finals and -- oh dear.. we almost forgot to do unix.. yes.. perl. .ok.. let's do a little project.. yes yes .. let's see.. let's have a web site where users can make accounts, change passwords, save data to a database via a form and maybe retrieve lsot passwords, let's have 20 or more people who don't exactly really want to do this try it out.. and open the stuff to the whole internet do our servers can get hacked and then uhm... ok you got a week. Oh! Almost forgot! It's almost ASP hour!"