Advertisement

06.05.2008 at 12:35PM PDT, ID: 23461634
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.8

Form fields with same name as array, differences from ASP to PHP and using Javascript

Asked by brad2575 in PHP Scripting Language, JavaScript

Tags:

Hello,

I am converting a site from ASP to PHP.  The conversion are just about done with one exception.  I am having an issue with form fields with the same name and how they are handled differently from ASP to PHP.

First what I am doing:  I have multiple form fields with the same name for not only checkboxes but all types of form fields (text boxes, selects, etc).  This is because the page is dynamically generated with multiple rows of data dynamically from the database and it allows the user to update one or all that are returned when the page is created.  The user can update 1 or 10 different items at the same time  (and each item has the same field name).  

This works fine in ASP and using Javascript for validation using the field name as an array of values.

I researched and see how I need to change the form field name to use "[]" after the name to make this work in PHP so I can access the values of the form as an array.  

My issue/question is:

1.  Is there a way I can keep all my Javascript validation without having to re-write it all (using an array of the form fields).  (I am currently using the form field name to access the values in the form fields).

2.  What kinds of updates/changes do I need to make to the Javascipt to make it work if I change the form fields to have "[]" on the end of the name and still work/validate properly?  I am currently using a LOT of functions that I just pass the object to the function and the function validates it, like this
     ValidateFunction(window.document.formName.fieldName)

3.  What type of error trapping/checking will I need to do in PHP if there is only one field/value returned vs. 10?  So the code will still execute properly if there is 1 field submitted on the form or if there are 10 with the same name?  

If I had to make changes to the Javascript what would I need to do in the Javascript to make the changes I had to make in PHP work in Javascript?

I am great with ASP and Javascript and getting PHP pretty quick.  I just want to find a way to make this work so I do not have to completely re-write all my form and Javascript code.

Thank you in advance for your help.Start Free Trial
[+][-]06.05.2008 at 12:39PM PDT, ID: 21723163

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.05.2008 at 12:46PM PDT, ID: 21723234

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.06.2008 at 04:34AM PDT, ID: 21727979

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.06.2008 at 05:05AM PDT, ID: 21728123

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: PHP Scripting Language, JavaScript
Tags: PHP Javascript
Sign Up Now!
Solution Provided By: hernst42
Participating Experts: 2
Solution Grade: A
 
 
[+][-]06.06.2008 at 05:49AM PDT, ID: 21728479

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-44 / EE_QW_2_20070628