On Sat, Feb 14, 2009 at 2:53 PM, Shahrukh Khan <[email protected]> wrote: > Hi to everyone, > > > I need help in my project where in a form, if you click a value of a combo > box then that value should be stored in mysql table. for eg: selecting sex > (male or female) should be stored along with user details in a single table. > > The table which i created is like this "create table person ( personID int > NOT NULL AUTO_INCREMENT,PRIMARY KEY(personID), > FirstName varchar(15), LastName varchar(15), Age varchar(5), DOB > varchar(20), sex varchar(6) )"; > > so except "sex column" all other values are stored as they are input fields > but for combo value, pls help me to store in that table itself....
I suggest that you use firebug (a firefox plugin). Using this you can clearly see what parameters the browser sent (to the server) and what were returned as a response (from the server). This will help you isolate the problem so you can focus your debugging efforts. If the combo box value was not even sent to the server then you'll have to focus on the javascript/html - perhaps the naming of the different combo box options. If it was sent to the server then the problem is on the server side. varchar's take a toll on DB performance. So its advisable to use chars as much as possible! 'sex' could be a CHAR(1) - M or F. Or maybe CHAR(2) if transgender's orientation needs to be captured. Age could be an integer (no. of days!). But when you are storing 'dob' (which should be a 'date' type) you can always infer the age any time - otherwise you'll have to keep incrementing the age field every year! And, be consistent in naming your tables. Am a rails enthusiast and I like its naming conventions. Perhaps you can use it. Or maybe Django's / CakePHP's. regds, mano _______________________________________________ To unsubscribe, email [email protected] with "unsubscribe <password> <address>" in the subject or body of the message. http://www.ae.iitm.ac.in/mailman/listinfo/ilugc
