How to add your own email in form

GK User
Sat Apr 15, 2017 7:26 am
How do I add my own email in the demo "information" module on the frontpage located on the "header bottom" position. I want to fix it so that when users request information I will receive it to my email. Current HTML code in the demo as per below:

<form class="gkInformation" action="#">
<div><strong>Get info based on<br /> your study lavel</strong> <input name="full-name" type="text" placeholder="Full name" /> <input name="education-level" type="text" placeholder="Your education level" /> <input name="email" type="email" placeholder="Your e-mail" /> <input type="submit" value="Request information" /></div>
</form>
User avatar
Fresh Boarder

teitbite
Wed Apr 19, 2017 9:39 am
Hi

You can use any Joomla Form extension, my favourite is RSForm. There You will be able to use any HTML (including demo one), so the look will not be changed, but form will be more functional.
User avatar
Moderator

GK User
Thu Apr 20, 2017 1:55 pm
I understand, I'm not too familiar with how to make forms in general. Exactly what I should I put in instead of "#" in order for the HTML code to work with various form-makers?

<form action="#" class="gkInformation">
User avatar
Fresh Boarder

teitbite
Fri Apr 21, 2017 1:21 pm
Hi

I do not think it will be all You have to do. It might, but all depends what system You will use. It may even need some custom codding to manage that. Safer would be use a 3rd party extension. Do not worry, it will lead You through the process of constructing form in an easy way (like drag-and-drop form elements).
User avatar
Moderator

teitbite
Fri Apr 21, 2017 1:32 pm
After little thinking, a very basic way of doing that can be by adding this code at the bottom of /layout/default.php

Code: Select all
<?php
if( $_POST['email'] !== 0 ):
mail( 'YOUR EMAIL ADDRESS', 'Informations request', $_POST['education-level'].' '.$_POST[full-name].' '.$_POST['email'] );
endif;
?>


so the # will have to be replaced with the url You wish site to be redirected to after sending the mail.

BUT!!!!

It's super basic. It does not provide security from hacking attacks via form fields, there is no messagegin or checking if correct values was given. Lots of more work would be needed. So it can be done like that, but You will need someone or a prepared system to handle all of that.
User avatar
Moderator


cron
Remember me
Register New Account
If you are old Gavick user, click HERE for steps to retrieve your account.