PHP array : Echo a $var inside a form with option value -
how can display variable $player->name inside form option value user select variable , submit form.
here's code not working :
<?php $team = $_post['team']; $result = file_get_contents("http://nhlwc.cdnak.neulion.com/fs1/nhl/league/teamroster/$team/iphone/clubroster.j son"); $json = json_decode($result); $goalies = $json->goali; foreach ($json->goalie $player) { **echo "<option value=\"".$player->name."\">".$player->name."</option>** } ?>
you did not have double quotes , semicolon @ end of statement.
<?php $team = $_post['team']; $result = file_get_contents("http://nhlwc.cdnak.neulion.com/fs1/nhl/league/teamroster/$team/iphone/clubroster.json"); $json = json_decode($result); $goalies = $json->goali; foreach ($json->goalie $player) { echo "<option value=\"".$player->name."\">".$player->name."</option>"; } ?>
Comments
Post a Comment