richiec Posted February 10, 2008 Share Posted February 10, 2008 Hey i have a group of 20 text boxes with a submit at the bottom when submit is clicked it puts the info of the 20 text boxes into DB then echos them on another page.. Thats working fine.. What i would like to do is when they click submit, it checks to make sure none of them are the same - no idea how to do this could someone show me an example.. Another thing each text box has to be 5 lines - not 4 or 6 is there anyway to check if it has 5 lines? One more thing lol... When it is put into the db, each text line are in new lines (like it should be) but when it is echoed back on the site it puts them in the same line... any idea how to make it echo exactly the same as it is in db? That last one doesnt sound very clear.. Say you have enterd 5 lines of text into 1 of the text boxes "line 1 line 2 line 3 line 4 line 5" it puts that into the db, but then on the site echos back "line 1 line 2 line 3 line 4 line 5" Thanks rich. Quote Link to comment Share on other sites More sharing options...
cunoodle2 Posted February 10, 2008 Share Posted February 10, 2008 I would suggest putting the 20 fields into an array and then using while loops to loop through them and compare. Unfortunatley comparing 20 different fields would be a little time consuming and resource hog as you have to compare 1 vs 2, 1 vs 3, 1 vs 4.... 1 vs 20 Then start at 2 and loop through.. 2 vs 3, 2 vs 4.... 2 vs 20 then... 3 vs 4, 3 vs 5.....3 vs 20 This would actually require your loop to go through itself 210 times just to compare the 20 different items. What I might suggest to you would be to first get the LENGTH of all 20 text boxes. Then sort by LENGTH. If 2 lengths are the same then compare elements to see if they match. This would cut down processing time and resource limits. Quote Link to comment Share on other sites More sharing options...
richiec Posted February 10, 2008 Author Share Posted February 10, 2008 lol alright thanks, anyone have any idea about the other things? Quote Link to comment 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.