sKunKbad Posted November 16, 2007 Share Posted November 16, 2007 I need $count to be inside $_POST['Q$count'] as in the following, but its not working. ++$count; echo "For question # $count, \"<em>" .$question->q. "</em>\", your answer was {$_POST['Q$count']}.<br />"; I've tried a few different things, but can't get it done. What am I doing wrong here? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/77593-variable-inside-variable/ Share on other sites More sharing options...
Lumio Posted November 16, 2007 Share Posted November 16, 2007 $_POST['Q'.$count] or $_POST["Q$count"] or $_POST["Q".$count] ... Quote Link to comment https://forums.phpfreaks.com/topic/77593-variable-inside-variable/#findComment-392746 Share on other sites More sharing options...
sKunKbad Posted November 16, 2007 Author Share Posted November 16, 2007 ok I figured it out on my own: ++$count; $num = "Q$count"; $qnum = $_POST[$num]; echo "For question # $count, \"<em>" .$question->q. "</em>\", your answer was $qnum.<br />"; Quote Link to comment https://forums.phpfreaks.com/topic/77593-variable-inside-variable/#findComment-392747 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.