Search the Community
Showing results for tags 'strrpos'.
-
Hi there. I have a small problem, i want to use strrpos and i dont want to make a textbox in the browser so i can write what ever word i want to search for and enter it. here is the code. $string = "Dette er en dummy tekst. Den kan bruges til mange forskellige ting.<p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam pellentesque faucibus pretium. Duis vehicula lacus vitae lacus adipiscing dignissim. Suspendisse mauris nulla, vehicula id orci semper, iaculis tincidunt nisl. Quisque congue magna eu elit posuere lacinia eu eget neque. Vivamus est sapien, porta at lacinia eget, commodo vitae lectus. Donec non velit at justo viverra suscipit eu quis purus. Integer tempor lacinia turpis, et aliquet est dignissim non. Aenean euismod dignissim turpis id sollicitudin. Phasellus vitae iaculis orci. Phasellus luctus faucibus tortor vitae porta. Proin semper tristique erat. Suspendisse ac fringilla elit, iaculis condimentum leo. Aliquam sit amet massa non dui congue laoreet eget et libero. Integer viverra nisi a justo tempor sollicitudin. Etiam volutpat aliquet malesuada. Ut erat neque, adipiscing sed dictum ut, commodo vel lacus.</p>"; echo '<h1>Strpos test</h1>'; echo ' <form> <input type="text" placeholder="Search" name="textbox" /> <input type="submit" name="searchButton" value="search" /> </form> '; if(isset($_POST['searchButton'])){ $textbox = $_POST['textbox']; }else{ echo 'type word to search '; } echo '<br />Your result is number '; echo strrpos($string, "word"); But i get the error that i have a Undefined variable: textbox in line 29 How can i make it so that what ever i enter in the textbox form will be the word that is searches for heres a link if you don't know what strrpos is. http://www.w3schools.com/php/func_string_strrpos.asp