Topic Closed
Ben
6 Posts

Hi all,

Ben from fauvdesign (www.fauvdesign.com) here. First of all: we're really impressed with the simplicity and ease of use that gpEasy brings to the table!

Now I have a little question to ask:

I've added the SMTP Contact Form to a website we're developing for a client:

http://vitalitynutritiontherapy.com.au/index.php/Contact_Us

Where it has the select field for Area of Interest, I don't know which PHP file to edit and what to add so that it adds the selected values to the email which is sent. Can anyone help?

Ben

9 years ago#1405

Stano
483 Posts
16.6K Downloads
1 Themes
1 Plugins

Hi Ben, open the file /data/_pages/smtpcontact.php in Notepad and insert into the message creation section (it should be about the line 33) the following three lines, so the form procession code will look probably something like this:

            $_body = "CONTACT FORM MESSAGE:".$eol;

            $_body .= 'Name: '.(isset($_name)? $_name:'-').$eol;

            $_body .= 'Phone: '.(isset($_phone)? $_phone:'-').$eol;

            $_body .= 'Email: '.(isset($_email)? $_email:'-').$eol;

            $_body .= 'Subject: '.(isset($_subject)? $_subject:'-').$eol;

            $_body .= 'Interests: ';

            foreach ($_POST['Area of Interest'] as $aoi)  do $_body .= $aoi.', ';

            $_body .= $eol;

            $_body .= 'Message: '.$_message;

This three emphasized lines will process your multiple select field.

Edited: 9 years ago#1406

Ben
6 Posts

Hi Stano,

Thanks for the reply. Unfortunately it's actually caused the Contact Form to become unviewable! I re-installed the plugin and published the form to the following page: http://vitalitynutritiontherapy.com.au/index.php/smtpcontact

I added the code in exactly the right place using textwrangler, let me know if you can think of a fix!

I did re-create the form, so maybe the code that you gave me needs to change?

Ben

 

Edited: 9 years ago#1409

Josh S.
2K Posts
284K Downloads
16 Themes
18 Plugins

Sorry for the trouble with 2.0 plugin compatability. Stano, let me know if there's more I can do to help.

9 years ago#1410

Stano
483 Posts
16.6K Downloads
1 Themes
1 Plugins

Oops, it's my mistake, I didn't test it well. So first, add square brackets after your form variable :

<select size="5" name="Area of Interest[]" multiple="multiple">

And the second part of the script should look like this:

$_body .= 'Interests: ';

if (isset($_POST['Area_of_Interest']))  {

  foreach ($_POST['Area_of_Interest'] as $aoi)  { 

    $_body .= $aoi.', ';

  }

}

$_body .= $eol;

And Josh thank you for help :-) I'll try to renew it

Edited: 9 years ago#1411

Ben
6 Posts

Stano,

You're a genius. Thanks heaps, it works!

Thanks for the quick replies as well! We've got a few more gpEasy sites that'll be going live in the next few months so it's handy to have this contact form as that's a pretty big deal for a lot of our clients!

Cheers again!

Ben

9 years ago#1412

Stano
483 Posts
16.6K Downloads
1 Themes
1 Plugins

:-) ... no genius, only i used google and know that code. okay, i am glad it helped you. so have a good time :-)

9 years ago#1413

Ben
6 Posts

ben here again,

just wanting to know if it's possible to have forms sent to multiple emails?

cheers,

ben

9 years ago#1414

Stano
483 Posts
16.6K Downloads
1 Themes
1 Plugins

yes it's possible to have multiple recipients in phpmailer. it's quite easy, simply multiple copy the AddAddress line:

$mail->AddAddress('[email protected]', 'first recipient');

$mail->AddAddress('[email protected]', 'second recipient');

$mail->AddAddress('[email protected]');

... and so on. (The second parameter is not required.)

9 years ago#1415

Ben
6 Posts

thanks again stano!

worked like a charm

9 years ago#1418

Stano
483 Posts
16.6K Downloads
1 Themes
1 Plugins

:-) so fine

Edited: 9 years ago#1428

Topic Closed

 

News

elFinder 2.1.50 in Upcoming Release
12/28/2019

A new release for Typesetter is in the works with a lot of improvements including the ... Read More

Typesetter 5.1
8/12/2017

Typesetter 5.1 is now available for download. 5.1 includes bug fixes, UI/UX improvements, ... Read More

More News

creisi productions

Dienstleistungen von creisi productions, Luzern (Schweiz): * Konzeption, Planung und Erstellung Ihres Internet-Auftritts * Betreuung und Aktualisierung/Pflege Ihrer Website * ...

Find out more about our Provider Spotlight

Log In

  Register