Just like indexed array, there are two different ways of creating an associative array in PHP, they are, 'Japan', 'Mexico-city' => 'Mexico', 'Washington D.C.An associative array is similar to an indexed array, but rather than storing data sequentially with numeric index, every value can be assigned with a user-designed key of string type. ?> " /> $country) $result = count($answer) echo $question ?> įor the second method I wanted to try if I can make it work having the form aligned vertically each containing the next question, but I still cannot get the submit button to individually work on each text field and count the score.Heres the code for second method: 'Japan', 'Mexico-city' => 'Mexico', 'Washington D.C.' => 'USA', 'New Delhi' => 'India', 'Seoul' => 'Zouth-Korea', 'Peking' => 'China', 'Abuja' => 'Nigeria', 'Buenos Aires' => 'Argentina', 'Cairo' => 'Egypt', 'London' => 'England', ] $answer = $question = 'What is the capital city of Japan?' $input = '' $country = '' $city = '' In my first method I try have the question form appear in one div, and try to have the variables in the form changed with each loop and submit button. however it gets stuck on the first question. using a submit button I need it to refresh the new question and store the answers. there is something wrong with the POST method, in addition to the foreach loop through the array. I've tried 2 methods of making my php quiz work in my html page.
0 Comments
Leave a Reply. |