View Full Version : A little help please

11-25-2008, 03:21 PM
Hi all.
I'm having some trouble with a certain project. Basically the site offers automatic inquiries about our services. When the form is filled out it is then sent to a certain e-mail. Dynamically added form elements are used in all the forms. In most of the forms a div is created and then the elements. Each element is named with an increasing name value(e.g. element1,element2 etc) so i can access them with a php loop later. In one of the forms it is required to create a div and optionally another one inside it. So when i post i can't get values from elements in the inner div, although i've traced them and the naming is correct. I'd be thankful for any advice on the subject!!

11-25-2008, 03:51 PM
You will need to post code, a link to your page, or something else in order for us to be of any help to you.
The form may not be sending properly, the elements may not be named properly, or the php loop to find them may not be working properly.

Remember, the other option is to name the second div of elements something different than the main div (like "elements2_1", etc.)

11-25-2008, 07:37 PM
Thanks for the quick reply. Sorry about the lack of code of anykind. My mistake.
Here is the code for the forms.
Sorry for the formatting and clearance of code. I know it's messed up but that's my type of faulty writing. Thanks again for the help!

11-26-2008, 01:31 PM
Hi guys.
I posted the attachment with the previous post because the site wasn't uploaded anywhere. Now i can give more useful links:
The page that is working: http://www.flyingcargo-bg.com/test/enqair.html

And the one that isn't working: http://www.flyingcargo-bg.com/test/enqsea.html


11-26-2008, 02:53 PM
If you give your elements names ending with [], then you can access them as an array within PHP. For example, if you have a set of inputs called foo[], and send them using POST, then in your PHP script they will be accessible as an array $_POST['foo'].

11-26-2008, 06:17 PM
Thanks for the advice. Will try this first thing tomorrow morning. Hope it works out. Funny thing is that i continued to trace elements after post today and they seem visible, but no such thing in php. Hope this works! Thanks!

12-03-2008, 07:13 AM
I tried the above method, but it doesn't work either. It still does not want to access variables and objects in the innermost div. The dynamically created div is only removed when it contains the objects created by its own script. When the other script for the inner lying div creates some elements the outer cannot be removed and the inner elements cannot be accessed!