php - splitting input words into an array -


i have little experience php , regular expressions. created simple html input form , submit button. following:

when button clicked, regexp splits input string array of words:

  1. that lowercase (with ã changed a)

  2. and 10 symbols long.

should that?

$search_string = $_get['keywords'];  $regexp = preg_split(^[a-za-z]{1,10}+$, $search_string);  $regexp = strtolower($search_string); 

this simple html code:

<div>        <label for="keywords">keywords:</label>        <input type="text" name="keywords"> </div>  <input type="submit" value="add records"> 

can me improve regexp code? doesn't seem working.

this code:

   <!doctype html> <html lang="en"> <head>     <meta charset="utf-8">     <title>document</title> </head> <body>     <form action="htmlform.php" method="post">         keywords <input type="text" name="keywords">         <input type="submit" value="submit">     </form>     <?php           $search_string = $_get['keywords'];          $regexp = preg_split("/^[a-za-z]{1,10}+$/", $search_string);           $regexp = strtolower($search_string);       ?> </body> </html> 

maybe because form method post looking @ $_get?

$search_string = $_post['keywords']; 

Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -