The "filetest.t xt" contents is here
............... ...
one/yes
two/no
three/maybe
four/fun
five/ok
............... .
The main program is here
............... ...........
<?php
srand((double) microtime() * 1000000);
$readfile = file("filetest. txt");
$k=rand(0, sizeof($readfil e)-2);
list($quest,$an sw) = split("/",$readfile[$k]);
print("$quest<B R>$answ<br>");
?>
<button onClick="alert( 'Question is : <?=$quest?>')"> Question1</button>
<button onclick="alert( <?php echo "'Question is : " . $quest ."'"; ?>)">Question2 </button><BR>
<button onClick="alert( 'Answer is : <?=$answ?>')">A nswer1</button>
<button onclick="alert( <?php echo "'Answer is : " . $answ ."'"; ?>)">Answer2</button>
<script>
<?php echo "var V='" . $answ ."';"; ?>
</script>
<button onclick="alert( V)">click</button>
............... ............... ..............
All the above "alert" popups work with the "Question" ($quest), or first item after reading the text file.
But none of them work with the "Answer" ($answ), or the second item in text file. Why?