arisecc Posted December 2, 2006 Share Posted December 2, 2006 not sure if this is the correct way of doing this, but i'd like to be able to do something with a php page receiving a forum such as:for ($ii;$ii<50;$ii++) { if (answer_$ii!="") { ///do something }}for example, it will loop through variables from $answer_1 to $answer_50. There's probably a much better way of doing this, I have a database of questions being added to a page dynamically (numbered 1 through 50) and I want to check through each if they have been answered. The answers are in radiobox or checkbox form, such as:...$linehere=mysql_fetch_array($r);<input type=\"radio\" class=\"checkbox\" name=\"".$linehere['id']."\" value=\"a\" />Hope this makes sense, any help would be great. Thanks Link to comment https://forums.phpfreaks.com/topic/29206-dynamic-varialbes/ Share on other sites More sharing options...
kenrbnsn Posted December 2, 2006 Share Posted December 2, 2006 You want to use [url=http://www.php.net/manual/en/language.variables.variable.php]variable variables[/url]Check the above reference.But... it would be much easier to use arrays here.Ken Link to comment https://forums.phpfreaks.com/topic/29206-dynamic-varialbes/#findComment-133965 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.