Tuesday, 15 April 2014

html - Need help in creating search box in Php -


I just started learning php before some weaknesses .. I'm working on a search box but I Can not get results

  & lt; Html & gt; & Lt; Head & gt; & Lt; Title & gt; Search form & lt; / Title & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Form action = "12.html" method = "received" & gt; & Lt; Input type = "text" name = "keyword" id = "keyword width =" 50 "value =" "/> & lt; input type =" submit "value =" search "/> gt; & lt; / Form & gt; & lt; / body & gt;  
Php $ searchfor = $ _GET ['keyword']; $ file = '12 .html '; $ content = file_get_contents ($ File); $ pattern = preg_quote ($ searchfor, '/'); $ patterns = "/^.*$pattern.*\$/m"; if (preg_match_all ($ patterns, $ content, $ matches)) {Resonance "found: P> My content for search is in the 12.html file, if I type the word in the search box then my The whole part of the page is coming as a result I need a specific line or word in it, which is not present in my content. My body of my files shows that I do not know where I can make a mistake, someone It can guide you. First of all, there are errors in your HTML syntax. You want you to have NT in your script.

  
gt; "; $ matches);} else {echo" No mail found ", Falcos ($ file);} ? & Gt;

I do not understand why you want to penetrate the matches, because it is only a list of the same words, though many times it was found. You can try this if you want to find a specific line.

     

No comments:

Post a Comment