morganaf Posted October 19, 2009 Share Posted October 19, 2009 code is below, I am creating a drop down menu. I want to echo the value selected in the drop down menu in the php file that is executed afterwards. when I echo frmcounty in the php file it returns .$value. which makes sense, but I can't figure out how to get access to the data in $value which is what I need I think. Thanks in advance. $sql = 'SELECT lottoName FROM `Lottos` ORDER BY `lottoName` '; $result = mysql_query($sql) or die("could not retrieve" .mysql_error()); echo '<select name="'.frmcounty.'" id="'.frmcounty.'"><option value="">Select one…</option>'; while($info = mysql_fetch_array($result,MYSQL_ASSOC)) { foreach($info as $value) { echo '<option value=".$value.">'.$value.'</option>'; } } echo "</select>"; echo '<input type="submit" value = "Submit" />'; ?> </form> </body> </html> <?php echo "hey"; extract($_POST); echo $value; $link = mysql_pconnect("pdb2.awardspace.com", "albert123_lotto", "lotto") or die("pconnectfailed!" .mysql_error()); mysql_select_db("albert123_lotto", $link) or die("unable to select db" .mysql_error()); $queryUpdate = 'INSERT INTO store_'.$store_num.'_wind (lottoName) VALUES('.$value.')'; $queryUpdateResult = mysql_query($queryUpdate, $link); ?> Link to comment https://forums.phpfreaks.com/topic/178188-solved-gaining-access-to-drop-down-menu-variable/ Share on other sites More sharing options...
trq Posted October 19, 2009 Share Posted October 19, 2009 It would be accessed via $_POST[frmcounty] assuming you have actually defined the frmcounty constant somewhere. Link to comment https://forums.phpfreaks.com/topic/178188-solved-gaining-access-to-drop-down-menu-variable/#findComment-939503 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.