my requirement is
textarea have 3 keywords. no need to count letters per line. but each keyword separated by commas. forexample: abc is one keyword, defgh is another keyword, kalpana is another keyword. so we are entering like this abc,defgh,kalpana into textarea . there is no need to count no.of characters per line. why b'coz we dont have length of the keywords. textarea must contain 3keywords seperated by commas. for this 3 keywords separated by only 2 commas. so we count only commas. i think u understood.
muralibobby2015
17
Posting Pro
Recommended Answers
Jump to PostI suggest that you 'explode' the string and then check that the parms exist in the array that is created.
Jump to PostHey.
You could also use the substr_count function.
if(substr_count($input, ',') == 2) { echo "Valid!;" }
Jump to PostFair enough, what happens if somebody (I assume you have users entering data, not just yourself) puts a comma at the end? The reason I ask is because I do this all the time without thinking. Do you get an error message or do you check to see if the …
Jump to PostIDs of elements don't work like the names of input elements. If you have two elements with the same ID, only one of them will be used by JavaScript. (The last one, I believe.)
So you need to rethink your approach.
A simple workaround is to have the elements …
All 14 Replies
chrishea
182
Nearly a Posting Virtuoso
Atli
182
Posting Pro

diafol
muralibobby2015
17
Posting Pro
muralibobby2015
17
Posting Pro
Atli
182
Posting Pro
muralibobby2015
17
Posting Pro
muralibobby2015
17
Posting Pro
muralibobby2015
17
Posting Pro
Atli
182
Posting Pro

diafol
muralibobby2015
17
Posting Pro
venkat0904
1
Junior Poster
muralibobby2015
17
Posting Pro
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.