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:
that lowercase (with ã changed a)
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
Post a Comment