I have a form where the user can select one of two radio buttons. I want to display a thank you message (On Submit code - after sending email) for the first option selected and another one for the second option. I thought it's something like:
<? php
if (/* some condition */) : ?>
<p>Thank you for choosing option one</p>
<? php else : ?>
<p> Thank you for choosing option two </p>
<? php endif; ?>
Does this look ok? What would the condition be?
<? php
if (/* some condition */) : ?>
<p>Thank you for choosing option one</p>
<? php else : ?>
<p> Thank you for choosing option two </p>
<? php endif; ?>
Does this look ok? What would the condition be?
Hi sorin74z,
Yes, that's pretty much it. The condition will depend on the value of a Request variable (assuming that you are using Joomla 1.5). The code will be like this
Bob
Yes, that's pretty much it. The condition will depend on the value of a Request variable (assuming that you are using Joomla 1.5). The code will be like this
<?php
$my_var = JRequest::getVar('myvar', ', 'post');
if ( $my_var = 'some value' ) {
echo "<p>Thank you for choosing option one</p>";
} else {
echo "<p> Thank you for choosing option two </p>";
}
?>
Bob
Hi Bob,
Thank you for your answer. It seems good, only I seem to have a problem when I try and add any sort of php code in the "On Submit code" section. I even tried:
<? php
echo "<p>Thank you for choosing option one</p>";
?>
and still get nothing displayed. If I don't use php (for example just write <p>Thank you for your reply</p>) it works fine, but with php nothing seems to happen. Could I have some wrong setting somewhere?
Thanks,
Sorin
PS: I'm using joomla 1.5
Thank you for your answer. It seems good, only I seem to have a problem when I try and add any sort of php code in the "On Submit code" section. I even tried:
<? php
echo "<p>Thank you for choosing option one</p>";
?>
and still get nothing displayed. If I don't use php (for example just write <p>Thank you for your reply</p>) it works fine, but with php nothing seems to happen. Could I have some wrong setting somewhere?
Thanks,
Sorin
PS: I'm using joomla 1.5
Hi sorin74z,
I didn't notice before but there is an extra space in the php tag - should be <?php - with no spaces. I don't think this is the problem though. Please can you post here the whole of the code you have in the OnSubmit Box.
Bob
I didn't notice before but there is an extra space in the php tag - should be <?php - with no spaces. I don't think this is the problem though. Please can you post here the whole of the code you have in the OnSubmit Box.
Bob
Hi Bob,
Thank you very much for the suggestion. I only tried the code I posted and it didn't work before, but once I removed the space between <? and php it worked fine.
So finally I have:
Many thanks,
Sorin
Thank you very much for the suggestion. I only tried the code I posted and it didn't work before, but once I removed the space between <? and php it worked fine.
So finally I have:
<?php
$my_var = JRequest::getVar('my_var', 'post');
if ( $my_var == 'option one' ) {
echo "<p>You chose option one</p>";
} else {
echo "<p>You chose another option</p>";
}
?>
This works fine.Many thanks,
Sorin
Using this code above..how would you handle this is people have more options to choose from in different fields?
I asume that you have
option 1 values 1 or 2
now I have
option1 values 1 2 3
option2 values a b c
option3 values aq de 4r
etc..
how could I the below and still display the right message?
I asume that you have
option 1 values 1 or 2
now I have
option1 values 1 2 3
option2 values a b c
option3 values aq de 4r
etc..
how could I the below and still display the right message?
This topic is locked and no more replies can be posted.