![]() |
| ||
| Form Fields Hello Everyone, I have a form (it is for a web based poll) it collects 4 pieces of information: 1) the poll question 2) the amoutn of choices 3) the start date of poll 4) the end date for poll Now when this form is submitted(same script $php_self) it takes the amount of choices entered and I run a for loop to get the amount of text-boxes I need in the new form, they are dynamically created using names choice1, choice2 and so on depending on the amount entered in the form before. That is not the problem, that part is working great. The problem comes in when I want to run a javascript script to get the values of the text fields, I use the following code: elseif (isset($_POST['submit1'])) The problem is that for some reason it ONLY recognizes the very first text input and not the others. All I get on the output is the value of the first text box not the others. is there something I am doing wrong? Is there anything in PHP that I could do to accomplish the same thing? Any and all help will be greatly appreciated. Thank you in advance Leo Zayas |
| ||
| Re: Form Fields I'm not sure I understand your goal, but it appears that when a user submits the form, you don't want the form to submit anywhere--instead you want to display the values from the form at the bottom of the page--one per line? From your code: [PHP]document.write(form.elements[count].value +"<br />");[/PHP] If that's the case, I'd use a DIV. In your page, where you want the values to appear, add this line: [PHP]<div id="values"></div>[/PHP] Then, in your checkForm() function, replace your document.write line with something like: [PHP] document.getElementById('values').innerHTML += form.elements[count].value+"<br />"; [/PHP] I'm not sure if I understood the issue--does this help you? |
| All times are GMT -4. The time now is 8:32 am. |
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC