hallo,
i ve created a dynamic form. A user can select The number of fields he d like to fill in (test creation)
echo '<form method="post" action="createxml.php">';
for ($i =1; $i <=$number; $i+=1){ // THE $NUMBER CONTAINS //VALUE -ok-
echo '<fieldset width ="20%">';
echo '<legend class = "login">WRITE A QUESTION</legend>';
echo ' <blockquote align="center">';
echo 'QUESTION '.$i.' (DESCRIPTION):<br>';
echo '<textarea name="q".$i rows="3" cols="50"></textarea><br><br>';
echo 'ANSWEAR 1:<textarea name="q".$i."a1" rows="1" cols="50"></textarea><br>';
echo 'ANSWEAR 2:<textarea name="q".$i."a2" rows="1" cols="50"></textarea><br>';
echo 'ANSWEAR 3:<textarea name="q".$i."a3" rows="1" cols="50"></textarea><br>';
echo 'ANSWEAR 4:<textarea name="q".$i.a4" rows="1" cols="50"></textarea><br>';
echo '<input type="submit">';
echo '</form>';
Now in createxml.php i want to get the values in order to write them inside xml file. i have tried a lot but i can not do it. the last code i used which caused unfinishing loop with empty values was this
echo "$number";//ok
for ($i =1; $i <=$number; $i+=1){
$q.$i = $_POST['q'.$i];
echo "$q.$i";// empty
echo "<br>";
$a.$i= $_POST["q".$i."a1"];
$a.$i= $_POST["q".$i."a2"];
$a.$i= $_POST["q".$i."a3"];
$a.$i= $_POST["q".$i."a4"];
echo "answear=".$_POST["q".$i."a4"];// empty
echo "<br>";
}
can u help me??????