I am trying to create an SQL query from the following:
<option value=5273>AALDEN</option><option value=5491>ALTEVEER GEM DE WOLDEN</option>
I post these line to the following code:
$aantal = substr_count($input,"</option>");
$query = array();
for($i = 1; $i<$aantal; $i++)
{
$output = ereg_replace("<option value= >", "", $input);
$output = "INSERT INTO steden(p_id, stad) VALUES('DR', '$input');";
$query[$i] = $output;
$output = "";
}
for($i = 0; $i<$aantal; $i++)
echo"$query[$i]<br>";
The problem is that my query looks like this:
INSERT INTO steden(p_id, stad) VALUES('DR', 'AALDENALTEVEER GEM DE WOLDEN ');
While it should be:
INSERT INTO steden(p_id, stad) VALUES('DR', 'AALDEN')
INSERT INTO steden(p_id, stad) VALUES('DR', 'ALTEVEER GEM DE WOLDEN ');
Can anybody help me out here? thx