Skip to main content
Fix bad copy-paste mistakes
Source Link
mickmackusa
  • 4.8k
  • 4
  • 18
  • 48

The $_POST array structure is determined by the name attribute of each field which exists inside of the <form></form> tags.

All of the basics are here: https://docs.joomla.org/Retrieving_request_data_using_JInput

The array option is appropriate when you have brace-syntax in the field's name to express a nested structure on the field's submission data. example

Although Joomla does have getArray(), I recommend that you systematically grab the field values individually and include the default value and sanitisation technique when accessing the data.

From docs: $input->post->get(param_name, default_value, filter);

In practice:

$emailTask   = $input->post->get('emailtask', '', 'CMD');
$emailTask$formId      = $input->post->get('formid', '', 'WORD');
$emailTask$emailAuthor = $input->post->get('emailauthor', '', 'RAW'); // because stripping tags can potentially damage fringe case email addresses; use additional sanitisation step before using this value
$emailTask$itemId      = $input->post->get('itemid', '', 'INT');
$emailTask$itemTitle   = $input->post->get('itemtitle', '', 'STRING');
$emailTask$itemAlias   = $input->post->get('itemalias', '', 'STRING');
$emailTask$itemAuthor  = $input->post->get('itemauthor', '', 'STRING');
$emailTask$catId       = $input->post->get('catid', '', 'INT');
$emailTask$return      = $input->post->get('return', '', 'RAW');

If your expected post data isn't even making it to the destination where you expect it, then your issue is not in receiving the data, but sending it to the right place.

I don't know what is rendered by:

'.$titleformD.'
'.$fields_display.'
'.$consent_field.'
'.$captcha_html.'

so I don't know know if there is <form></form> inside of your form tags.

The $_POST array structure is determined by the name attribute of each field which exists inside of the <form></form> tags.

All of the basics are here: https://docs.joomla.org/Retrieving_request_data_using_JInput

The array option is appropriate when you have brace-syntax in the field's name to express a nested structure on the field's submission data. example

Although Joomla does have getArray(), I recommend that you systematically grab the field values individually and include the default value and sanitisation technique when accessing the data.

From docs: $input->post->get(param_name, default_value, filter);

In practice:

$emailTask = $input->post->get('emailtask', '', 'CMD');
$emailTask = $input->post->get('formid', '', 'WORD');
$emailTask = $input->post->get('emailauthor', '', 'RAW'); // because stripping tags can potentially damage fringe case email addresses; use additional sanitisation step before using this value
$emailTask = $input->post->get('itemid', '', 'INT');
$emailTask = $input->post->get('itemtitle', '', 'STRING');
$emailTask = $input->post->get('itemalias', '', 'STRING');
$emailTask = $input->post->get('itemauthor', '', 'STRING');
$emailTask = $input->post->get('catid', '', 'INT');
$emailTask = $input->post->get('return', '', 'RAW');

If your expected post data isn't even making it to the destination where you expect it, then your issue is not in receiving the data, but sending it to the right place.

I don't know what is rendered by:

'.$titleformD.'
'.$fields_display.'
'.$consent_field.'
'.$captcha_html.'

so I don't know know if there is <form></form> inside of your form tags.

The $_POST array structure is determined by the name attribute of each field which exists inside of the <form></form> tags.

All of the basics are here: https://docs.joomla.org/Retrieving_request_data_using_JInput

The array option is appropriate when you have brace-syntax in the field's name to express a nested structure on the field's submission data. example

Although Joomla does have getArray(), I recommend that you systematically grab the field values individually and include the default value and sanitisation technique when accessing the data.

From docs: $input->post->get(param_name, default_value, filter);

In practice:

$emailTask   = $input->post->get('emailtask', '', 'CMD');
$formId      = $input->post->get('formid', '', 'WORD');
$emailAuthor = $input->post->get('emailauthor', '', 'RAW'); // because stripping tags can potentially damage fringe case email addresses; use additional sanitisation step before using this value
$itemId      = $input->post->get('itemid', '', 'INT');
$itemTitle   = $input->post->get('itemtitle', '', 'STRING');
$itemAlias   = $input->post->get('itemalias', '', 'STRING');
$itemAuthor  = $input->post->get('itemauthor', '', 'STRING');
$catId       = $input->post->get('catid', '', 'INT');
$return      = $input->post->get('return', '', 'RAW');

If your expected post data isn't even making it to the destination where you expect it, then your issue is not in receiving the data, but sending it to the right place.

I don't know what is rendered by:

'.$titleformD.'
'.$fields_display.'
'.$consent_field.'
'.$captcha_html.'

so I don't know know if there is <form></form> inside of your form tags.

Source Link
mickmackusa
  • 4.8k
  • 4
  • 18
  • 48

The $_POST array structure is determined by the name attribute of each field which exists inside of the <form></form> tags.

All of the basics are here: https://docs.joomla.org/Retrieving_request_data_using_JInput

The array option is appropriate when you have brace-syntax in the field's name to express a nested structure on the field's submission data. example

Although Joomla does have getArray(), I recommend that you systematically grab the field values individually and include the default value and sanitisation technique when accessing the data.

From docs: $input->post->get(param_name, default_value, filter);

In practice:

$emailTask = $input->post->get('emailtask', '', 'CMD');
$emailTask = $input->post->get('formid', '', 'WORD');
$emailTask = $input->post->get('emailauthor', '', 'RAW'); // because stripping tags can potentially damage fringe case email addresses; use additional sanitisation step before using this value
$emailTask = $input->post->get('itemid', '', 'INT');
$emailTask = $input->post->get('itemtitle', '', 'STRING');
$emailTask = $input->post->get('itemalias', '', 'STRING');
$emailTask = $input->post->get('itemauthor', '', 'STRING');
$emailTask = $input->post->get('catid', '', 'INT');
$emailTask = $input->post->get('return', '', 'RAW');

If your expected post data isn't even making it to the destination where you expect it, then your issue is not in receiving the data, but sending it to the right place.

I don't know what is rendered by:

'.$titleformD.'
'.$fields_display.'
'.$consent_field.'
'.$captcha_html.'

so I don't know know if there is <form></form> inside of your form tags.