Hello all! I am having an issue with setting up a form where the user can select from a dropdown menu the purpose of the email, and based on that selection, the form will direct the message to the appropriate email. Below is the sample code for the form that I created:
[code]
<label>First Name: </label>
<input name="fname" type="text" id="fname" class="textField1"/>
</p>
<p>
<label>Last Name: </label>
<input name="lname" type="text" id="lname" class="textField1" />
</p>
<p>
<label>Your Email: </label>
<input name="email" type="text" id="email" class="textField1" />
</p>
<p>
<label>Phone Number: </label>
<input name="phone" type="text" id="phone" class="textField1"/>
</p>
<p>
<label>Purpose of the Message: </label>
<select name="recipient" id="recipient" class="textField1" >
<option selected="selected">Please Select</option>
<option value="email1@domain.com">Selection1</option>
<option value="email2@domain.com">Selection2</option>
<option value="email3@domain.com">Selection3</option>
<option value="email4@domain.com">Selection4</option>
<option value="email5@domain.com">Selection5</option>
</select>
</p>
<p>
<label>Message: </label>
<textarea name="message" id="message" class="textField2"></textarea>
</p>
<p>
<label>
[code]
<label>First Name: </label>
<input name="fname" type="text" id="fname" class="textField1"/>
</p>
<p>
<label>Last Name: </label>
<input name="lname" type="text" id="lname" class="textField1" />
</p>
<p>
<label>Your Email: </label>
<input name="email" type="text" id="email" class="textField1" />
</p>
<p>
<label>Phone Number: </label>
<input name="phone" type="text" id="phone" class="textField1"/>
</p>
<p>
<label>Purpose of the Message: </label>
<select name="recipient" id="recipient" class="textField1" >
<option selected="selected">Please Select</option>
<option value="email1@domain.com">Selection1</option>
<option value="email2@domain.com">Selection2</option>
<option value="email3@domain.com">Selection3</option>
<option value="email4@domain.com">Selection4</option>
<option value="email5@domain.com">Selection5</option>
</select>
</p>
<p>
<label>Message: </label>
<textarea name="message" id="message" class="textField2"></textarea>
</p>
<p>
<label>
put "recipient" in the special fields tab, email field field!
Cheers
Max
Cheers
Max
Hey Max, thanks for the reply. I have that field filled in as well with recipient, but still doesn't work. Any other suggestions?
Hi dvalle,
It's not good practice to show email addresses in your web page - they'll get spammed for sure. There's an example in FAQ 31 that may be useful.
Bob
It's not good practice to show email addresses in your web page - they'll get spammed for sure. There's an example in FAQ 31 that may be useful.
Bob
GREAT! Thank you for the help Bob! That PHP line of code did the trick.
Thank! :woohoo:
Thank! :woohoo:
I'm interested in this solution as well but the link is no longer working ... any help?
check FAQ #31 from the list we have now!
Good stuff! The only problem I have now is that the form doesn't seem to be emailing ....?
Here are the results from the debug:
* Form passed first SPAM check OK
* Form passed the submissions limit (if enabled) OK
* Form passed the Image verification (if enabled) OK
* Form passed the server side validation (if enabled) OK
* Form passed the plugins step (if enabled) OK
* Emails data loaded OK
* Form passed all before email code evaluation OK
* Debug End
_POST: Array ( [text_0] => Kevin [text_1] => 2222 [select_2] => Civil & Structural Engineering [text_3] => sss [undefined] => Submit [c1a12197664e7f080607c2c778e9c6d6] => 1 )
I don't know where to go from here...
* Form passed first SPAM check OK
* Form passed the submissions limit (if enabled) OK
* Form passed the Image verification (if enabled) OK
* Form passed the server side validation (if enabled) OK
* Form passed the plugins step (if enabled) OK
* Emails data loaded OK
* Form passed all before email code evaluation OK
* Debug End
_POST: Array ( [text_0] => Kevin [text_1] => 2222 [select_2] => Civil & Structural Engineering [text_3] => sss [undefined] => Submit [c1a12197664e7f080607c2c778e9c6d6] => 1 )
I don't know where to go from here...
Hi kdesilva,
Nope, 'fraid not. Either Max has changed the debug or something is killing the code before it gets to the point of sending the email. I'm not sure which.
Bob
Nope, 'fraid not. Either Max has changed the debug or something is killing the code before it gets to the point of sending the email. I'm not sure which.
Bob
Hi Bob,
Yes, Debug code was changed alittle!🙂
@kdesilva, the new V3.0 is alittle different, lets start from the beginning, do you have any emails setup and enabled ? you should see how many emails are enabled/disabled in front of every form at the forms management page!
let me know!
Regards
Max
Yes, Debug code was changed alittle!🙂
@kdesilva, the new V3.0 is alittle different, lets start from the beginning, do you have any emails setup and enabled ? you should see how many emails are enabled/disabled in front of every form at the forms management page!
let me know!
Regards
Max
This is what I have for the form:
Enabled:0
Disabled:0
Is that what you mean? I have "email the results" set to "yes"
Enabled:0
Disabled:0
Is that what you mean? I have "email the results" set to "yes"
I don't have anything under the tab "setup emails" however .. I wanted to use the dynamic method of the drop down like what was suggested in FAQ 31
ok, first add some email, refer to the setup emails tutorial at the downloads > chronoforms tutorials, after you add an email and test it success let me know and I can show you the V3.0 way, its in another recent topic here! will try to find it!
here you are, check this post, we did it with checkboxes and not a dropdown, this is the V3.0 approach:
http://www.chronoengine.com/forums/index.php?option=com_chronoforums&cont=posts&f=2&t=11177&start=0&st=0&sk=t&sd=a
http://www.chronoengine.com/forums/index.php?option=com_chronoforums&cont=posts&f=2&t=11177&start=0&st=0&sk=t&sd=a
ok, reading now - is this going to affect the multiple email listing I already set up?
Ok done that and tried out .. no email yet ..
by the way .. do you notice the captcha is a bit buggy in firefox? Sometimes it says I've typed in the wrong code, then I try it again a couple times and it works ..
That's for a different topic though ... no email through yet..
by the way .. do you notice the captcha is a bit buggy in firefox? Sometimes it says I've typed in the wrong code, then I try it again a couple times and it works ..
That's for a different topic though ... no email through yet..
Did you add any code of that post yet ? you need to see at least Enabled:1 in the forms management, does this happen ?
yeah I've added that code the post talked about ...
and I do have enabled: 1
and I do have enabled: 1
please remove any code and test receiving normal email as I mentioned in my earlier post, we must make sure your site emails!
Ok, I took out that code from the on submit and it emails fine...
here is the code I was using:
here is the code I was using:
<?php
$emails = array('em1'=>'info@vertigo.bm', 'em2'=>'info@vertigo.bm', 'em3'=>'info@vertigo.bm', 'em4'=>'info@vertigo.bm', 'em5'=>'info@vertigo.bm');
$rows[0]->extraemail = $emails[$_POST['recipients']];
?>
Hi, your code should be :
assuming your dropdown name is recipients
Cheers
Max
<?php
$emailslist = array('em1'=>'info@vertigo.bm', 'em2'=>'info@vertigo.bm', 'em3'=>'info@vertigo.bm', 'em4'=>'info@vertigo.bm', 'em5'=>'info@vertigo.bm');
$emails[0]->to = $emailslist[$_POST['recipients']];
?>
assuming your dropdown name is recipients
Cheers
Max
Form
on submit
Still no emails
<div class="form_item"><h1>Contact Us</h1><div class="form_element cf_textbox"><label class="cf_label">Name</label><input class="cf_inputbox" maxlength="150" size="30" id="text_0" name="text_0" type="text"></div><div class="clear">Â </div></div><div class="form_item"><div class="form_element cf_textbox"><label class="cf_label">Number</label><input class="cf_inputbox" maxlength="150" size="30" id="text_1" name="text_1" type="text"></div><div class="clear">Â </div></div><div class="form_item"><div class="form_element cf_dropdown"><label class="cf_label">Interested in:</label><select class="cf_inputbox" id="recipients" size="1" name="recipients"><option value="em1">Civil & Structural Engineering</option><option value="em2">Mechanical Engineering</option><option value="em3">Building & Quantity Surveying</option><option value="em4"> Valuation</option><option value="em5"> Land Surveying</option></select></div><div class="clear">Â </div></div><div class="form_item"><div class="form_element cf_textarea"><label class="cf_label">Comments</label><textarea class="cf_inputbox" rows="3" id="text_3" cols="30" name="text_3"></textarea></div><div class="clear">Â </div></div><div class="form_item"><div class="form_element cf_captcha"><label class="cf_label">Verification</label><span>{imageverification}</span></div><div class="clear">Â </div></div><div class="form_item"><div class="form_element cf_button"><input value="Submit" name="undefined" type="submit"></div><div class="clear">Â </div></div>
on submit
<?php
$emails = array('em1'=>'info@vertigo.bm', 'em2'=>'info@vertigo.bm', 'em3'=>'info@vertigo.bm', 'em4'=>'info@vertigo.bm', 'em5'=>'info@vertigo.bm');
$rows[0]->extraemail = $emails[$_POST['recipients']];
?>
Still no emails
Your onsubmit code is wrong, please check my last post above how the onsubmit code looks, it should go on the onsubmit before email box!
Max
Max
Hi Max!
But now the Email goes out to:
To: [email]info@example.com[/email], em2
Do you know a way to remove the "em2" from the recipients?
But now the Email goes out to:
To: [email]info@example.com[/email], em2
Do you know a way to remove the "em2" from the recipients?
Which Chronoforms version do you have ?
This topic is locked and no more replies can be posted.