<html>
<body>
<form method="post">
<input type="text" name="advance_search">
<button type="submit">Send</button>
</form>
</body>
<html>
this input field submit the value like that (apple and banana and orange)or(milk and bread) this input is converted for MySQL Boolean search like that (+apple +banana +orange) (+milk +bread) how can i achieve using PHP i can write some code but its not done
if (isset($_POST['advance_search'])) {
$str_and = str_ireplace(' and','+',$_POST['advance_search']);
$str_brac_and = str_ireplace(')and',')+',$str_and);
$str_quote = str_replace('\'', '"',$str_brac_and);
$str_or = str_ireplace(' or',' ',$str_quote);
$trim_str = trim($str_or);
}
Comments
Post a Comment