Skip to main content
added 75 characters in body
Source Link
Victor
  • 8.4k
  • 1
  • 36
  • 61

I'm trying to get data submitted from a form using craft()->request->getPost()craft()->request->getPost(), but I'm not sure what to do when the form name is an array element.

For example, I have a form with:

<label for="notes">Notes</label>
<textarea rows="6" id="notes" name="fields[notes]"></textarea>
<label for="notes">Notes</label>
<textarea rows="6" id="notes" name="fields[notes]"></textarea>

Andand want to use:

craft()->request->getPost('fields[notes]');
craft()->request->getPost('fields[notes]');

but when I do this I don't get any data from the form, and I'm not sure what to put in getPost()getPost() to let it know its an array.

It will work fine if I change the name to "notes" and use getPost('notes')getPost('notes'), but I'd like to be able to get it working with the array.

I'm trying to get data submitted from a form using craft()->request->getPost(), but I'm not sure what to do when the form name is an array element.

For example, I have a form with

<label for="notes">Notes</label>
<textarea rows="6" id="notes" name="fields[notes]"></textarea>

And want to use

craft()->request->getPost('fields[notes]');

but when I do this I don't get any data from the form, and I'm not sure what to put in getPost() to let it know its an array.

It will work fine if I change the name to "notes" and use getPost('notes'), but I'd like to be able to get it working with the array.

I'm trying to get data submitted from a form using craft()->request->getPost(), but I'm not sure what to do when the form name is an array element.

For example, I have a form with:

<label for="notes">Notes</label>
<textarea rows="6" id="notes" name="fields[notes]"></textarea>

and want to use:

craft()->request->getPost('fields[notes]');

but when I do this I don't get any data from the form, and I'm not sure what to put in getPost() to let it know its an array.

It will work fine if I change the name to "notes" and use getPost('notes'), but I'd like to be able to get it working with the array.

deleted 4 characters in body
Source Link

I'm trying to get data submitted from a form using craft()->request->getPost(), but I'm not sure what to do when the form name is an array element.

For example, I have a form with

<label for="notes">Notes</label>
<textarea rows="6" id="emp_notes"id="notes" name="fields[notes]"></textarea>

And want to use

craft()->request->getPost('fields[notes]');

but when I do this I don't get any data from the form, and I'm not sure what to put in getPost() to let it know its an array.

It will work fine if I change the name to "notes" and use getPost('notes'), but I'd like to be able to get it working with the array.

I'm trying to get data submitted from a form using craft()->request->getPost(), but I'm not sure what to do when the form name is an array element.

For example, I have a form with

<label for="notes">Notes</label>
<textarea rows="6" id="emp_notes" name="fields[notes]"></textarea>

And want to use

craft()->request->getPost('fields[notes]');

but when I do this I don't get any data from the form, and I'm not sure what to put in getPost() to let it know its an array.

It will work fine if I change the name to "notes" and use getPost('notes'), but I'd like to be able to get it working with the array.

I'm trying to get data submitted from a form using craft()->request->getPost(), but I'm not sure what to do when the form name is an array element.

For example, I have a form with

<label for="notes">Notes</label>
<textarea rows="6" id="notes" name="fields[notes]"></textarea>

And want to use

craft()->request->getPost('fields[notes]');

but when I do this I don't get any data from the form, and I'm not sure what to put in getPost() to let it know its an array.

It will work fine if I change the name to "notes" and use getPost('notes'), but I'd like to be able to get it working with the array.

Source Link

getPost() on array element in plugin

I'm trying to get data submitted from a form using craft()->request->getPost(), but I'm not sure what to do when the form name is an array element.

For example, I have a form with

<label for="notes">Notes</label>
<textarea rows="6" id="emp_notes" name="fields[notes]"></textarea>

And want to use

craft()->request->getPost('fields[notes]');

but when I do this I don't get any data from the form, and I'm not sure what to put in getPost() to let it know its an array.

It will work fine if I change the name to "notes" and use getPost('notes'), but I'd like to be able to get it working with the array.