Mr Chris Posted June 20, 2007 Share Posted June 20, 2007 Hi All, I have a piece of code where I get the player_id value from the url at the top of the page. Rather than this I want to get the value from variable named $player_one. <?php $p_id = (isset($_GET['player_id']) ? intval($_GET['player_id']) : ''); ?> <select class="input" name="player_one" size="1" style="width: 145" tabindex="1"> <option value="" <?php echo ($p_id == '' ? 'selected="selected"' : ''); ?>>player_one</option> <?php $type_array=get_player_names(); foreach ($type_array as $players) { ...code } ?> </select> So I thought it would be something like this: <?php $p_id = $player_one ? $player_one : ''; ?> Rather than: <?php $p_id = (isset($_GET['player_id']) ? intval($_GET['player_id']) : ''); ?> But it does not pull out the value. Can anyone help? Thanks Chris Link to comment https://forums.phpfreaks.com/topic/56338-solved-value-in-a-dropdown/ Share on other sites More sharing options...
Mr Chris Posted June 20, 2007 Author Share Posted June 20, 2007 Got it! That does work. There was something wrong with the rest of my code. Thanks anyway! Link to comment https://forums.phpfreaks.com/topic/56338-solved-value-in-a-dropdown/#findComment-278431 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.