943,522 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 1473
  • PHP RSS
Jan 18th, 2009
0

get data from a dynamic form

Expand Post »
hallo,

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

php Syntax (Toggle Plain Text)
  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

php Syntax (Toggle Plain Text)
  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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
dourvas is offline Offline
20 posts
since Dec 2008
Jan 18th, 2009
0

Re: get data from a dynamic form

hey I see you posted this on www.devnetworkforums.net.. what the hell... check your answer there
Reputation Points: 7
Solved Threads: 1
Junior Poster in Training
it2051229 is offline Offline
82 posts
since May 2007
Jan 18th, 2009
0

Re: get data from a dynamic form

Try to fix this line

PHP Syntax (Toggle Plain Text)
  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.
Reputation Points: 10
Solved Threads: 1
Newbie Poster
Yayo_SK is offline Offline
11 posts
since Jan 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Can I use a variable from..........
Next Thread in PHP Forum Timeline: External JavaScript and PHP Problem





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC