Below is the code i've been trying to use to make a series of options, some are just 'continue' while others you choose between the options and it changes in which direction the story goes. The code as is is live at thecycle.ie but at the moment when you click 'continue' it changes , correctly to start, and you click it again and it goes back to the first entry.
Basically when you click i want it to store a value, and use that value to check along with $i, which goes up as you go through the game, which choice was made and output the correct values.
$i = 0;
$question = simplexml_load_file('xml/question.xml');
$opt1 = $question->entry[$i]->opt1;
$opt2 = $question->entry[$i]->opt2;
$story = simplexml_load_file('xml/story.xml');
$theSpeaker = $story->entry[$i]->speaker;
$theSpeech = $story->entry[$i]->speech;
echo'<form method="post" action="main.php">';
if($_POST['click']=='opt0' && $i==0)
{
$i = 1;
$theSpeaker = $story->entry[$i]->speaker;
$theSpeech = $story->entry[$i]->speech;
echo '<h2>'.$theSpeaker.'</h2>';
echo '<p>'.$theSpeech.'</p>';
echo '</div>
<div id="menu_about" class="menu_start">
<br>
<button type="submit" name="click" id="submit" value="opt1">'.$opt1.'</button>
</div>
</div>
</div>';
}
elseif($_POST['click']=='opt1' && $i==1)
{
$i = 2;
$theSpeaker = $story->entry[$i]->speaker;
$theSpeech = $story->entry[$i]->speech;
echo '<h2>'.$theSpeaker.'</h2>';
echo '<p>'.$theSpeech.'</p>';
echo '</div>
<div id="menu_about" class="menu_start">
<br>
<button type="submit" name="click" id="submit" value="opt2">'.$opt1.'</button>
</div>
</div>
</div>';
}
else
{
$i = 0;
$theSpeaker = $story->entry[$i]->speaker;
$theSpeech = $story->entry[$i]->speech;
echo '<h2>'.$theSpeaker.'</h2>';
echo '<p>'.$theSpeech.'</p>';
echo '</div>
<div id="menu_about" class="menu_start">
<br>
<button type="submit" name="click" id="submit" value="opt0">'.$opt1.'</button>
</div>
</div>
</div>';
}