Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $html = '<div id="one">
- <select id="first">
- </select>
- </div>
- <div id="two">
- <select id="second">
- </select>
- </div>';
- $dom = new DOMDocument();
- $dom->validateOnParse = true;
- $dom->loadHTML($html);
- $result_one = get_model();
- $string = "audi BMW BMW Ford Ford Ford Ford Ford A6 'A5' mokka mokka.";
- if($result_one == true){
- while($row = mysqli_fetch_array($result_one)){
- $pattern = "/b" . $row["name_model"] . "b/i";
- if (preg_match_all($pattern, $string, $matches)){
- for ($i=0; $i < count($matches[0]); $i++){
- $count = count($matches[0]);
- $result = $matches[0][$i];
- $result_id = $row["brand_id"];
- }//echo $count;
- $item = $dom->getElementById('first');
- $opt = $item->appendChild($dom->createElement("option", $result));
- $query = "SELECT * ";
- $query .= "FROM brands ";
- $query .= "WHERE brand_id = $result_id ";
- $result_match = mysqli_query($link, $query);
- $result_two = $result_match;
- var_dump($result_two);
- if($result_two == true) {
- while($row = mysqli_fetch_array($result_two)){
- $res = $row["brand_name"];
- $item_2 = $dom->getElementById('second');
- $opt = $item_2->appendChild($dom->createElement("option", $res));
- }
- }
- }
- }
- }
- echo $dom->saveHTML();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement