Jump to content

text fields


richiec

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
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.