Forums

Help with user select email with drop down menu

dvalle 12 Jul, 2008
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>
Max_admin 13 Jul, 2008
put "recipient" in the special fields tab, email field field!

Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
dvalle 13 Jul, 2008
Hey Max, thanks for the reply. I have that field filled in as well with recipient, but still doesn't work. Any other suggestions?
GreyHead 17 Jul, 2008
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
dvalle 17 Jul, 2008
GREAT! Thank you for the help Bob! That PHP line of code did the trick.

Thank! :woohoo:
kdesilva 30 Sep, 2008
I'm interested in this solution as well but the link is no longer working ... any help?
Max_admin 30 Sep, 2008
check FAQ #31 from the list we have now!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
kdesilva 30 Sep, 2008
Good stuff! The only problem I have now is that the form doesn't seem to be emailing ....?
GreyHead 30 Sep, 2008
Hi kdesilva ,

What do you see in the DeBug display?

Bob
kdesilva 30 Sep, 2008
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...
kdesilva 30 Sep, 2008
Does that help any?
GreyHead 30 Sep, 2008
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
Max_admin 30 Sep, 2008
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
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
kdesilva 30 Sep, 2008
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"
kdesilva 30 Sep, 2008
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
Max_admin 30 Sep, 2008
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!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
kdesilva 30 Sep, 2008
ok, reading now - is this going to affect the multiple email listing I already set up?
kdesilva 30 Sep, 2008
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..
Max_admin 30 Sep, 2008
Did you add any code of that post yet ? you need to see at least Enabled:1 in the forms management, does this happen ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
kdesilva 30 Sep, 2008
yeah I've added that code the post talked about ...

and I do have enabled: 1
Max_admin 30 Sep, 2008
please remove any code and test receiving normal email as I mentioned in my earlier post, we must make sure your site emails!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
kdesilva 30 Sep, 2008
Ok, I took out that code from the on submit and it emails fine...

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']];
?>
kdesilva 30 Sep, 2008
so how do I get it to work the way I want with the php code now?
Max_admin 30 Sep, 2008
Hi, your code should be :


    <?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
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
kdesilva 30 Sep, 2008
Form
<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
Max_admin 30 Sep, 2008
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, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
emka73 10 Oct, 2008
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?
Max_admin 10 Oct, 2008
Which Chronoforms version do you have ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.