marcus Posted November 24, 2006 Share Posted November 24, 2006 Say I have an array of words that I didn't want the user to submit, and if they did submit one of the words it would submit completely, a message would come up saying that they said one of the words. Quote Link to comment https://forums.phpfreaks.com/topic/28291-how-would-i-do-this/ Share on other sites More sharing options...
.josh Posted November 24, 2006 Share Posted November 24, 2006 really? then what? Quote Link to comment https://forums.phpfreaks.com/topic/28291-how-would-i-do-this/#findComment-129381 Share on other sites More sharing options...
btherl Posted November 24, 2006 Share Posted November 24, 2006 Can you give us an idea of your level of php experience? And more detail about what you're doing? For example, are you using a forum package? Quote Link to comment https://forums.phpfreaks.com/topic/28291-how-would-i-do-this/#findComment-129383 Share on other sites More sharing options...
marcus Posted November 24, 2006 Author Share Posted November 24, 2006 I stated that wrong.How would I be able to create a document that checks if the user submitted a word that was in an array. If they did submit a word it would come up with a message saying like "blah blah blah bad word." And if no word from the array was found it would complete the task. Something like:[code]<?php$mesg = $_POST[message];$array = array("words,that,the,user,cannot,submit");if($mesg == $array){echo "bad word";}else {echo "fine statement";};?>[/code]something like that, but how would I make it to check if $mesg included any of the words in $array Quote Link to comment https://forums.phpfreaks.com/topic/28291-how-would-i-do-this/#findComment-129385 Share on other sites More sharing options...
Philip Posted November 24, 2006 Share Posted November 24, 2006 This seems to be a popular topic today - matching variables in an array.http://www.phpfreaks.com/forums/index.php/topic,116097.0.html might help ;) Quote Link to comment https://forums.phpfreaks.com/topic/28291-how-would-i-do-this/#findComment-129390 Share on other sites More sharing options...
Stooney Posted November 24, 2006 Share Posted November 24, 2006 try reading up on http://us3.php.net/str_replaceand if it's not to your liking then, http://us3.php.net/ereg_replace Quote Link to comment https://forums.phpfreaks.com/topic/28291-how-would-i-do-this/#findComment-129393 Share on other sites More sharing options...
marcus Posted November 24, 2006 Author Share Posted November 24, 2006 Well, I don't want to replace any words. Quote Link to comment https://forums.phpfreaks.com/topic/28291-how-would-i-do-this/#findComment-129394 Share on other sites More sharing options...
Philip Posted November 24, 2006 Share Posted November 24, 2006 Look at the way fert did it in the post I linked to.It doesn't replace words. Quote Link to comment https://forums.phpfreaks.com/topic/28291-how-would-i-do-this/#findComment-129406 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.