Salut,
Vreau sa fac un cititor rss care preia din fişierul XML lista adreselor cu feed-uri şi umple select (option) box cu aceste adrese si cand selectez o anumita adresa sa imi emita continutul RSS aflat pe adresa respectiva.
Am codul de mai jos dar problema e ca nu reusesc sa afisez variabilele $feed1 si $feed2 doar cand aleg din selectbox una din optiuni.
<?php
$rss = simplexml_load_file('http://mashable.com/feed/');
$feed1 = '<h3>'. $rss->channel->title . '</h3>';
foreach ($rss->channel->item as $item) {
$feed1 .= '<h4><a href="'. $item->link .'">' . $item->title . "</a></h4>";
}
$rss = simplexml_load_file('http://feeds.feedburner.com/TechCrunch/');
$feed2 = '<h3>'. $rss->channel->title . '</h3>';
foreach ($rss->channel->item as $item) {
$feed2 .= '<h4><a href="'. $item->link .'">' . $item->title . "</a></h4>";
}
?>
<!DOCTYPE html>
<head>
<title>RSS</title>
<meta charset="utf-8">
</head>
<body>
<form action="" method="post" name="myform" id="myform">
<select name="coder">
<option value="#tabs-1">Mashable</option>
<option value="#tabs-2">TechCrunch</option>
</select>
<input type="submit" name="submit" value="Submit"/>
</form>
</body>
</html>