split function problem<

teller =1;
$mog=$row['AantalMogelijkheden'];
// content for example : 3, is variable

$mogelijk = $row['Mogelijkheden'];
//content for example: test1/test2/test3

$vraag =$row['Formulering'];
//content : Question 1

what do i want to see?

question1
test1
test2
test3




while($teller< $mog)
{
list($mogelijkheid)= split('/',$mogelijk);


echo "<input type = \"radio\" name = \"$vraag\" value = \"$mogelijkheid\" > $mogelijkheid $teller";
//echo $teller;
echo '<br>';

$teller ++;
}
?>

when i use this code i get :

question1
test1
test1
test1

can somebody help me?
if 'AAntalmogelijkheden' = 4 i get test1/test2/Test3/Test4 /
so it must adjust.

if you can help me please i am searching a lot on this problem and haven't found it.

greetingsTry this:


<?php

$mogelijkheid= explode('/',$mogelijk);

for ($teller = 0; $teller < $mog; $teller++)
{
echo "<input type=\"radio\" name=\"$vraag\" value=\"".$mogelijkheid[$teller]."\">".$mogelijkheid[$teller]."<br>";

}

?>


list() (<!-- m --><a class="postlink" href="http://www.php.net/manual/en/function.list.php">http://www.php.net/manual/en/function.list.php</a><!-- m -->) is not used that way you were using it, and split() (<!-- m --><a class="postlink" href="http://www.php.net/manual/en/function.split.php">http://www.php.net/manual/en/function.split.php</a><!-- m -->) is overkill, also not used quite like that.
explode() (<!-- m --><a class="postlink" href="http://www.php.net/manual/en/function.explode.php">http://www.php.net/manual/en/function.explode.php</a><!-- m -->) is what you want... Setting $teller = 1 will skip the first 'testx' value, so set it to 0.this thread is a continuance of this thread

<!-- m --><a class="postlink" href="http://www.htmlforums.com/showthread.php?s=&threadid=30740thanks">http://www.htmlforums.com/showthread.ph ... 0740thanks</a><!-- m --> it works!
 
Back
Top