hi joel24
apologies for the delay in replying i have only just had the opportunity to revisit this and your suggestions have really been a massive help so wanted to say thanks very much for your time!
i am left with one small issue which i can't seem to get my head around if yourself or anyone here can give me some pointers it would be much appreciated...
for ($i=0;$i<$charsGettingRemoved;$i++){
$randomCharToRemove = getRandomCharToRemove($charsRemoved,$strLength);
$charsRemoved[$randomCharToRemove]=substr($word,$randomCharToRemove,1);
$word = substr_replace($word,'*',$randomCharToRemove,1);
}
in your code above i understand that this part
$word = substr_replace($word,'*',$randomCharToRemove,1);
is where it replaces the randomly removed character with a star '*'
instead of a star '*' i would like the removed characters to be replaced with:
<input type="text" name="question_1_letters[]" class="inputs" maxlength="1" value="" />
so i can display the full word with a mixture of unremoved characters and inputs where characters have been removed eg B[input]e[input], [input]ees, B[input][input]s, etc etc so the user just has to enter those characters which have been randomly removed, then it goes on to check if there were correct...
however if i change the code to
for ($i=0;$i<$charsGettingRemoved;$i++){
$randomCharToRemove = getRandomCharToRemove($charsRemoved,$strLength);
$charsRemoved[$randomCharToRemove]=substr($word,$randomCharToRemove,1);
$word = substr_replace($word,'<input type=\"text\" name=\"question_1_letters[]\" class=\"inputs\" maxlength=\"1\" value=\"\" />',$randomCharToRemove,1);
}
sometimes it works and other times it seems to replace parts of the input html code breaking it in the process...
i assume i'm missing something big here but really not sure how to have the code echo the input html rather than the *
many thanks in advance for any help!