Hi,
I have a form with a select input named "cours" and I want to send a mail according to what was selected in that input. So I set a hidden destmail field
Problem is: the magic doesn't happen, the destmail field is not updated...
here is my php code:
and here is the html of the select box:
I have a form with a select input named "cours" and I want to send a mail according to what was selected in that input. So I set a hidden destmail field
Problem is: the magic doesn't happen, the destmail field is not updated...
here is my php code:
<?php
if (stripos($cours, 'cinéma') !== false)
{
$destmail = 'cinema@acte4.be';
}
else if (stripos($cours, 'ados') !== false)
{
$destmail = 'ados@acte4.be';
}
else if (stripos($cours, 'théâtre') !== false)
{
$destmail = 'theatre@acte4.be';
}
?>
and here is the html of the select box:
<select size="1" id="cours" class=" validate['required']" title="" type="select" name="cours">
<option value="">(sélectionnez)</option>
<option value="théâtre">Théâtre</option>
<option value="cinéma">Cinéma</option>
<option value="ados">Ados</option>
<option value="stage cinéma juillet">Stage Cinéma Juillet</option>
<option value="stage cinéma août">Stage Cinéma Août</option>
<option value="stage ados juillet">Stage Ados Juillet</option>
<option value="stage ados août">Stage Ados Août</option>
</select>
Hi jeango,
You aren't actually getting a value for $cours anywhere. Please try
Nor are you doing anything with $destmail. Assuming that you have destmail in a Dynamic To box for your Email configuration you will need to add
I think that will do the trick.
Bob
You aren't actually getting a value for $cours anywhere. Please try
<?php
$cours = JRequest::getString('cours', '', 'post');
if (stripos($cours, 'cinéma') !== false)
{
$destmail = 'cinema@acte4.be';
. . .
Nor are you doing anything with $destmail. Assuming that you have destmail in a Dynamic To box for your Email configuration you will need to add
. . .
{
$destmail = 'theatre@acte4.be';
}
$form->data['destmail'] = $destmail;
?>
I think that will do the trick.
Bob
that did indeed do the trick, thank you
Small question though:
could I have just done $cours = $form->data['cours'] instead of calling the getString method of JRequest? was there a reason to get that information from the request header rather than the $form variable?
Small question though:
could I have just done $cours = $form->data['cours'] instead of calling the getString method of JRequest? was there a reason to get that information from the request header rather than the $form variable?
This topic is locked and no more replies can be posted.