Re: Manipulating variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I must be missing something, why do you need to use variable variables when checking user answers?

The logic should be something like:

$answer_key = array('question1' => 'answer', 'question2' => 'answer', ....);

foreach($answer_key as $q => $a)
{
    check_answer($_POST[$q], $a);
}

Regards,

-Josh
____________________________________
Joshua Kehn | Josh.Kehn@xxxxxxxxx
http://joshuakehn.com

On Feb 23, 2011, at 11:48 PM, Ron Piggott wrote:

> 
> Is there a way to make this syntax:
> 
> $checking_answer = $answer_reference_2;
> 
> Equal to:
> 
> $checking_answer = $answer_reference_ . ($i + 1);
> 
> (where $i = 1)
> 
> making $checking_answer take on the value of $answer_reference_2 ?
> 
> I am trying to develop a web app quiz and I need to test the users answers.
> 
> Ron
> 
> The Verse of the Day
> “Encouragement from God’s Word”
> http://www.TheVerseOfTheDay.info 


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux