If an user enters wirds in a textfield, what is the code for removing predefined words (I make a list and script searches it, if a word is found to be excluded it is not passed on to a query.
ALSO how do I make some word defined for logical operators - AND, OR , NOT, how to tell the script what to do if it finds them
[SOLVED]How to exclude some words - from FORM before query
Moderator: General Moderators
[SOLVED]How to exclude some words - from FORM before query
Last edited by Calimero on Fri Jun 25, 2004 5:38 am, edited 1 time in total.
- Derfel Cadarn
- Forum Contributor
- Posts: 193
- Joined: Thu Jul 17, 2003 12:02 pm
- Location: Berlin, Germany
I wouldnt have a clue i only know that
Will disable the text field
Code: Select all
READONLY TABINDEX="-1I would need help from the expirienced one :)
Derfel Cadarn
Programmer>
I am very new to PHP, so the code would be VERY helpful, I'm still learning, but .... Some basic things I still havent grasped.
IF someone has the time for the code, THANKS, I would realy apreciate it.

Programmer>
I am very new to PHP, so the code would be VERY helpful, I'm still learning, but .... Some basic things I still havent grasped.
IF someone has the time for the code, THANKS, I would realy apreciate it.
- Derfel Cadarn
- Forum Contributor
- Posts: 193
- Joined: Thu Jul 17, 2003 12:02 pm
- Location: Berlin, Germany
Yeah, well, euhhh I just got that title automatically by writing more than 100 postings in this forum. It has nothing to do with my (in)abilities...Calimero wrote:Derfel Cadarn
Programmer>
Check out Volka with 5000 postings or so...
But back to your problem: I don't have the code ready for you, but I think a method of how to solve the problem could be of some help, perhaps?
Assuming you know HTML and a BIT of PHP:
1. write the form with the textfield (name=textfield).
2. <form action="posting.php" method="post" blahblah>.
The posting.php-script needs to do something like this:
1. define an array containing the forbidden words.
2. read the text the visitor has written as a whole with $_POST[textfield].
3. with the function [php_man]split[/php_man] you can split the text into an array containing the words (split the text at each space).
4. And now: [php_man]foreach[/php_man] word in the array compare it with the words in the array with the forbidden words: if the same then delete the words from text.
I know this sounds very complicated, perhaps I didn't explain it too well either. But this is the method I'd use.
Success!!