跳至内容

欢迎!

This community is for professionals and enthusiasts of our products and services.
Share and discuss the best content and new marketing ideas, build your professional profile and become a better marketer together.

此问题已终结
作为版主,您可以批准或拒绝该答案。
接受 拒绝
42 查看

This is current alternative method, not a longer method

if u use

================================

$this->execPieceByName('ff_InitLib');


date_default_timezone_set('Asia/Kuala_Lumpur');


$name = ff_getSubmit('name');

$contact_no = ff_getSubmit('contact_no');

$email = ff_getSubmit('email');


$remarks = "Contact Form";

$remarks .= "\nMessage: ".ff_getSubmit('message');

======================================

but unable get the field value, u can try below method

=======================================

// Get the application object

$app = \Joomla\CMS\Factory::getApplication();


// Get the input object

$input = $app->input;


// Get submitted form data

$formData = $input->post->getArray();


// Extract individual field values from the array

$name = isset($formData['ff_nm_name'][0]) ? $formData['ff_nm_name'][0] : '';

$email = isset($formData['ff_nm_email'][0]) ? $formData['ff_nm_email'][0] : '';

$contact_no = isset($formData['ff_nm_contact_no'][0]) ? $formData['ff_nm_contact_no'][0] : '';

$message = isset($formData['ff_nm_message'][0]) ? $formData['ff_nm_message'][0] : '';


// Prepare remarks

$remarks = "Contact Form";

$remarks .= "\nName: " . $name;

$remarks .= "\nEmail: " . $email;

$remarks .= "\nContact No: " . $contact_no;

$remarks .= "\nMessage: " . $message;


but the fromData['name'], the name should according to ur form's name

Inspect to check the name of the field

Put [0] is ensure it can get the first one


Summary:

This is joomla get input function. If the system not support $this->execPieceByName('ff_InitLib'); method due to unknow reason, u can try this method first.

形象
丢弃

您的回复

请大家尽量给个实质性的回答。如果您想回答这个问题或发表评论,只需 使用评论工具。请记住,您可以随时修改您的答案。 - 不用重复回答同样的问题。另外,请不要忘记投票 - 它确实有助于选择最好的问题和答案!

相关帖文 回复 查看 活动
0
7月 24
81
1
1月 24
79
1
11月 23
75
1
12月 23
80
1
11月 23
68