--- Gordon Stewart <[EMAIL PROTECTED]> wrote: > > Question :- <INPUT TYPE=TEXT NAME='QUESTION'><BR> > Answer 1 <INPUT TYPE=TEXT NAME='ANSWERS'><BR> > Answer 2 <INPUT TYPE=TEXT NAME='ANSWERS'><BR> > Answer 3 <INPUT TYPE=TEXT NAME='ANSWERS'><BR> > Answer 4 <INPUT TYPE=TEXT NAME='ANSWERS'><BR> > Answer 5 <INPUT TYPE=TEXT NAME='ANSWERS'><BR> > > Thats the HTML - > > I know in the past - with CGI / Perl - That if I have an HTML form > with the same 'NAME' - It can be extracted by an array - & then > extract the variables... > > HOWEVER - with PHP, im only getting the 5th result - Using PHP... - Is > this possible ?
You need to give PHP a hint that the form variable should be stored in an array. One way to do this is by adjusting your name somewhat: Answer 1 <INPUT TYPE=TEXT NAME='ANSWERS[]'><BR> When PHP receives the form data, it will automatically number the index values as they are received. If you need to have more control over the index keys used you can number them in your HTML: Answer 1 <INPUT TYPE=TEXT NAME='ANSWERS[1]'><BR> Answer 2 <INPUT TYPE=TEXT NAME='ANSWERS[2]'><BR> Answer 3 <INPUT TYPE=TEXT NAME='ANSWERS[3]'><BR> Answer 4 <INPUT TYPE=TEXT NAME='ANSWERS[4]'><BR> Answer 5 <INPUT TYPE=TEXT NAME='ANSWERS[5]'><BR> Given the repetetive nature of your situation, you will probably want to create a function to display the question and answer inputs. Were it me I would also set up the function to make the form input sticky per an earlier thread. I've created functions for radio buttons, checkboxes, select lists and multiselect lists. I didn't see much application for a text box but it could be achieved fairly easily. I'm guessing that you are making some kind of quiz creation system. After all, most multiple choice quizzes would use radio buttons or checkboxes to accept answers for ease of grading. James Community email addresses: Post message: [EMAIL PROTECTED] Subscribe: [EMAIL PROTECTED] Unsubscribe: [EMAIL PROTECTED] List owner: [EMAIL PROTECTED] Shortcut URL to this page: http://groups.yahoo.com/group/php-list Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/php-list/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
