php won't pass variable to php rss function -
i have http://communitychessclub.com/test.php
i have php function named "getposts" want send url form:
<form action="#" method = "post"> <input type="hidden" name="sub" value="1" /> <select name="url" id="url"> <option value="http://www.chess.com/rss/articles">chess.com</option> <option value="http://chesscafe.com/feed/">chess cafe</option> <option value="http://www.chessdom.com/rss">chessdom</option> <option value="http://chess-news.ru/rss-eng">chess-news</option> </select> </form> for reason, php code below doesn't grab option selected , pass function. why that?
<?php $sub = intval( $_post["sub"]); if ($sub == 1){ $url= $_post["url"]; } else{ $url = "http://www.theweekinchess.com/twic-rss-feed"; } getposts($url); ?>
its because there no submit button. if want auto-submit form on change need like
<form name="myform" action="#" method = "post"> <select name="url" id="url" onchange="document.forms['myform'].submit()"> i checked , looks works fine.
also don't need $sub thing, can do
<?php if(isset($_post["url")){ $url = $_post["url"]; } else{ $url = "http://www.theweekinchess.com/twic-rss-feed"; } getposts($url); ?>
Comments
Post a Comment