I'm new in php.
I'm trying to find a way to match the right url dynamically in every description.
For example in the case where the description = Xios i would like the url to become :<li><div id="Left1"><a href="main.php?description=Xios">' . make_safe( $item['description'] ) . '</a></div></li>
Now in the case where the description = Kiklades i would like the url to become : <li><div id="Left1"><a href="main.php?description=Kiklades">' . make_safe( $item['description'] ) . '</a></div></li>
Endly in the case where the description = Mikonos i would like the url to become :<li><div id="Left1"><a href="main.php?description=Mikonos">' . make_safe( $item['description'] ) . '</a></div></li>
foreach ($item_array as $item) {
if ( make_safe($item['diamerisma']) == $_GET['diamerisma'] ) {
if (!in_array($item['description'], $used_values) ) {//This will check if this value hasn't been listed yet
$html .= '<ul data-role="listview" id="weatherList" data-theme="b" data-insert="true" >';
$html .= '<li><div id="Left1"><a href="main.php?description=Κυκλάδες">' . make_safe( $item['description'] ) . '</a></div></li>';
$html .= '</ul>';
$html .= '</dd>';
$used_values[] = $item['description'];//here you preserve used values for avoiding repetition
}
}
}
the xml code
<item>
<title>Xios center</title>
<description>Xios</description>
<diamerisma>Aigaio</diamerisma>
<metar>1010</metar>
</item>
<item>
<title>Siros</title>
<description>Kiklades</description>
<diamerisma>Aigaio</diamerisma>
<metar>1011</metar>
</item>
<item>
<title>Naxos center</title>
<description>Kiklades</description>
<diamerisma>Aigaio</diamerisma>
<metar>1012</metar>
</item>
<item>
<title>Mikonos center</title>
<description>Mikonos</description>
<diamerisma>Aigaio</diamerisma>
<metar>1013</metar>
</item>
Any help will be appreciated!thanks in advance guys!