get data from a dynamic form

Reply

Join Date: Dec 2008
Posts: 12
Reputation: dourvas is an unknown quantity at this point 
Solved Threads: 0
dourvas dourvas is offline Offline
Newbie Poster

get data from a dynamic form

 
0
  #1
Jan 18th, 2009
hallo,

i ve created a dynamic form. A user can select The number of fields he d like to fill in (test creation)

  1. echo '<form method="post" action="createxml.php">';
  2. for ($i =1; $i <=$number; $i+=1){ // THE $NUMBER CONTAINS //VALUE -ok-
  3.  
  4. echo '<fieldset width ="20%">';
  5. echo '<legend class = "login">WRITE A QUESTION</legend>';
  6. echo ' <blockquote align="center">';
  7. echo 'QUESTION '.$i.' (DESCRIPTION):<br>';
  8. echo '<textarea name="q".$i rows="3" cols="50"></textarea><br><br>';
  9. echo 'ANSWEAR 1:<textarea name="q".$i."a1" rows="1" cols="50"></textarea><br>';
  10. echo 'ANSWEAR 2:<textarea name="q".$i."a2" rows="1" cols="50"></textarea><br>';
  11. echo 'ANSWEAR 3:<textarea name="q".$i."a3" rows="1" cols="50"></textarea><br>';
  12. echo 'ANSWEAR 4:<textarea name="q".$i.a4" rows="1" cols="50"></textarea><br>';
  13.  
  14. echo '<input type="submit">';
  15. 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

  1. echo "$number";//ok
  2. for ($i =1; $i <=$number; $i+=1){
  3. $q.$i = $_POST['q'.$i];
  4. echo "$q.$i";// empty
  5. echo "<br>";
  6.  
  7. $a.$i= $_POST["q".$i."a1"];
  8. $a.$i= $_POST["q".$i."a2"];
  9. $a.$i= $_POST["q".$i."a3"];
  10. $a.$i= $_POST["q".$i."a4"];
  11.  
  12. echo "answear=".$_POST["q".$i."a4"];// empty
  13. echo "<br>";
  14.  
  15. }

can u help me??????
Last edited by peter_budo; Jan 18th, 2009 at 2:13 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 81
Reputation: it2051229 is an unknown quantity at this point 
Solved Threads: 1
it2051229 it2051229 is offline Offline
Junior Poster in Training

Re: get data from a dynamic form

 
0
  #2
Jan 18th, 2009
hey I see you posted this on www.devnetworkforums.net.. what the hell... check your answer there
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 11
Reputation: Yayo_SK is an unknown quantity at this point 
Solved Threads: 1
Yayo_SK Yayo_SK is offline Offline
Newbie Poster

Re: get data from a dynamic form

 
0
  #3
Jan 18th, 2009
Try to fix this line

  1. echo 'ANSWEAR 4:<textarea name="q".$i.a4" rows="1" cols="50"></textarea><br>';

echo 'ANSWEAR 4:<textarea name="q".$i."a4" rows="1" cols="50"></textarea><br>';

missing quote
Last edited by peter_budo; Jan 18th, 2009 at 2:14 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC