I am working on a backoffice of a survey/poll system and what I want to do is to insert questions by pressing a button without refresh, so in Javascript.
I have many fields for a question, such like required, question itself, details of the question, image file, etc...
Which is the best way to do it, and how can I access these data in the processing PHP file?
UPDATE
It seems I was not quite clear. I am talking about a simple form, with a SUBMIT BUTTON AT THE END. My other button just inserts new table rows with form elements for another question/answers. (let's say 1 question and 4 answers fields).
If the client has the data (arrays i guess) needed, then yes you can use javascript using DOM to achieve this. But if you need to communicate with the server to retrieve this data, then you will need AJAX. We need to know this in order to give you a complete answer.
When the user answers the poll, I imagine that you will be using a FORM like so :
<FORM METHOD="POST" ACTION="TheProcessingPHPfile.php">
Obviously you could now use the $_POST object to process the data (answer) submitted.