<?php
$xml = simplexml_load_file('/exam/'.$file);
foreach($xml->main as $main)
{
if($main['select'] == "selected")
{ ?>
<div>
<textarea rows="2" class="span11"><?php echo $main->question ?></textarea>
<div class="row" style="padding-left:3%;margin-bottom:1%;">
<ul>
<?php
foreach($main->ans as $ans)
{ ?>
<li style="float:left; margin-left:1%;" ><input type="radio" name="optionsRadios" class="rdChk" style="margin-top:-2%"> <span><?php echo $ans ?></span></li>
<?php }
?>
</ul>
</div >
</div>
<?php }
}
?>
myxml file is
<?xml version="1.0"?>
<root>
<main id="283" select="selected">
<question>qw</question>
<ans right="true">qwq</ans>
<ans>wqw</ans>
<ans>qwq</ans>
<ans>wqwqw</ans>
</main>
<main id="56" select="selected">
<question>qwewqe</question>
<ans right="true">qwe</ans>
<ans>qweqwe</ans>
</main>
.........
i want to see one quetion in one page...
Vivek_13 0 Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.