• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Condition on form

Condition on form 10 years 10 months ago #28080

Hello to all!

What I have: one form with TextBox, RadioGroup (Yes/No), HiddenField and Submit Button.

In form Properties >> PHP Scripts >> $_POST I have:
$public = $_POST['form']['radiogroup'];
$name = $_POST['form']['textbox'];
$conf = 'confidelity';
$no = 'No';
 
if ( $public = $no ) { 
$hidden = $conf;
} else {
$hidden = $name;
}
 
$_POST['form']['hidden'] = $hidden;

Whatever I checked "Yes" or "No" HidenField Value always return 'confidelity', but must changes 'confidelity' or TextBox Value.

Please help!!!
The administrator has disabled public write access.

Condition on form 10 years 10 months ago #28083

  • cosmin.cristea
  • cosmin.cristea's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 756
  • Thank you received: 144
You can approach this matter in a different way. Let's assume you have this 4 components in your form:
A textbox - name
A radio group - radio
A hidden field - hidden
and a submit button.
if($_POST['form']['radio'] == 'Yes'){
	$_POST['form']['hidden'] = $_POST['form']['name'];
	}
	else $_POST['form']['hidden'] = 'Confidential';

PS:For debugging purpose, you can add at the end of the code :
	print_r($_POST);die();

Information and examples on this topic can be found in the following articles:
Custom php code and PHP Scripts
My help is not official customer support. To receive your support, submit a ticket by clicking here
Last Edit: 10 years 10 months ago by cosmin.cristea.
The administrator has disabled public write access.
The following user(s) said Thank You: antivizor

Condition on form 10 years 10 months ago #28087

Thanks.

But where I made eroor?
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!