I have a bootstrap form which I need to send to am email address once the contact form has been submitted. I've built the form using Bootstrap but I've not used PHP before and I'm not sure how to integrate this with the rest of the site.
Is there an alternative to PHP for simply and safely submitting this form data to the email address?
<div class="row" id="contact_us_form">
<h1>Ready to talk?</h1>
<h4 style="margin-bottom:30px">Please call 0345897394852, email email#email.com or fill out the contact form below for a FREE 15 minute consultation.</h4>
<div class="col-sm-5 form-group">
<input class="form-control" id="name" name="fname" placeholder="First Name" type="text" required>
<input class="form-control" id="name" name="lname" placeholder="Last Name" type="text" required>
<input class="form-control" id="email" name="email" placeholder="Email" type="email" required>
</div>
<div class="col-sm-7 form-group">
<textarea class="form-control" id="comments" name="comments" placeholder="Message" rows="5"></textarea>
</div>
<div class="col-sm-12 form-group"><button class="btn btn-default pull-right" type="submit">Send</button></div>
</div>
You could do it in a few steps. Or just one tutorial.
You should first learn some more about how PHP form handling works. Start with this: http://www.w3schools.com/php/php_forms.asp (Dont forget the <form> tags around your form, as you currently do not have these)
(You could do validation, as you want it safely send: http://www.w3schools.com/php/php_form_url_email.asp)
Then move on to sending emails. As linked by #shubham: How to send an email using PHP?
It is not that hard. There are many complete tutorials online. As a simple google search delivered this tutorial: http://www.html-form-guide.com/email-form/php-form-to-email.html
Also be cautious when implementing a contact form. A contact form without captcha validation is prone to spam. Please consider implementing captcha. Hope this helps.
Related
I have this my sign up form in my php Laravel site which I think hackers and robots are making unnecessary sign-ups. But now, I want to allow only Valid Gmail users to create an account. I have configured this form but users with unknown mails are able to sign up. I'm a newbie in php Laravel codes. Someone should please help me configure this to achieve the goal. Thanks in advance. See form bellow.
#csrf
<div class="form-group">
<input type="text" name="name" class="form-control" placeholder="{{__('Full Name')}}">
</div>
<div class="form-group">
<input type="text" name="username" class="form-control" placeholder="{{__('Username')}}">
</div>
<div class="form-group">
<input type="email" name="email" class="form-control" placeholder="{{__('Gmail')}}">
</div>
<div class="form-group">
<input type="tel" name="tel" class="form-control" placeholder="{{__('WhatsApp Number')}}">
</div>
<div class="form-group">
<input type="text" name="gender" class="form-control" placeholder="{{__('Gender')}}">
</div>
<div class="form-group">
<input type="text" name="item" class="form-control" placeholder="{{__('What do you want to buy? Please type in your issues here')}}">
</div>
Laravel have great set of email validation tools. Here you can find some detail explanation: https://minuteoflaravel.com/validation/laravel-email-validation-be-aware-of-how-you-validate/
I think that will be enough to prevent most "hackers and robots" emails.
If you still want to accept "gmail.com" addresses only, then you can use, again, laravel ends-with validator:
'email' => ['ends_with:gmail.com', ...]
If you want to be sure that they are real emails then I suggest you implement laravel email verification
For more strict verification you can also use some external services like Mailgun email verification.
To stop bots from signing up, you can integrate a captcha service like ReCaptcha.
There are multiple packages which can help you reduce the amount of code to be written. Try having a look at laravel-recaptcha package on Github.
We are adding Moodle to our site (different server, different sub-domain, but same main domain, and the servers are set up to be able to communicate with each other) and what we want to have it do is:
if the User accesses the main site
User logs in User clicks a link to Moodle
The user is automatically logged into Moodle without
having to reenter their info.
i have added the html form with hidden type in my main domine as moodle post url.
Main domine:
<form class="mt-3" action="http://localhost/moodle/login/index.php" method="post" id="login">
<input id="anchor" type="hidden" name="anchor" value="">
<script>document.getElementById('anchor').value = location.hash;</script>
<input type="hidden" name="logintoken" value="xUe9G7a012vTHpvtOxAfzu84YJ046pu4">
<input type="hidden" name="loginhas" value="eda690fdf">
<div class="form-group">
<label for="username" class="sr-only">Username / email</label>
<input type="text" name="username" id="username" class="form-control" value="admin" placeholder="Username / email" autocomplete="username">
</div>
<div class="form-group">
<label for="password" class="sr-only">Password</label>
<input type="password" name="password" id="password" value="eda690fdf" class="form-control" placeholder="Password" autocomplete="current-password">
</div>
<div class="rememberpass mt-3">
<input type="checkbox" name="rememberusername" id="rememberusername" value="1">
<label for="rememberusername">Remember username</label>
</div>
<button type="submit" class="btn btn-primary btn-block mt-3" id="login">Log in</button>
How to accept this request in moodle ? or if you have any rolution regarding this issue plese help me out of this.
Don't know if possible with Moodle. We do it for several systems using CAS (central authentication service), where several yii2 apps login against a CAS implemented with web2py.
In the Yii side we use https://github.com/2amigos/yii2-usuario for user management and https://github.com/daxslab/yii2-cas-client for auth against the CAS.
Perhaps you need to implement a CAS on Yii and check how make that Moodle authenticates against it.
Hello Guys Im brand spanking new to PHP. I created a contact form in html. I barely installed Mamp on my mac last night and directed the web server to my projects folder in my home folder (not where my project is located).
right now I created two files, one file is the html file for the contact form and the other file is the webform.php.
What do I need to do in order to make this work? Should I change the html file to php or do I need to redirect my web server?
When I click on the send button im getting an error in my browser saying "This page isn’t workingIf the problem continues, contact the site owner.
HTTP ERROR 405"
<div class="contact-form bg-yellow p-2">
<h2 class="m-heading">Contact us</h2>
<p>Pleaes use the form below to contact us</p>
<form action="webform.php" method="POST" class="contactform">
<div class="form-group">
<label for="name">Name</label>
<input type="text" name="name" id="name" placeholder="Enter Name">
</div>
<div class="form-group">
<label for="email">Email</label>
<input type="email" Email="email" id="email" placeholder="Enter Email">
</div>
<div class="form-group">
<label for="message">Message</label>
<textarea name="message" rows="10" id="message" placeholder="Enter Message"></textarea>
</div>
<input type="submit" value="Send" class="btn btn-black">
</form>
</div>
I want to create send email form for wordpress page.
WordPress did not allow php But I can use php by using some plugin.
The problem is I did not know how to create it.
I can not make php file separate. Following is my html code.
please help me to write php code.
php should be separate I can insert it at top or bottom of page. but not in separate file
<form action="" method="post">
<div class="form-group">
<label name="first_name">Name:</label>
<input type="text" class="form-control">
</div>
<div class="form-group">
<label name="email">Email:</label>
<input type="email" class="form-control" name="email">
</div>
<div class="form-group">
<label name="subject">Subject:</label>
<input type="text" class="form-control" name="subject">
</div>
<div class="form-group">
<label name="message">Message:</label>
<textarea type="textarea" rows="5" class="form-control" name="message"></textarea>
</div>
<button type="submit" name="submit" class="btn btn-default">Send</button>
</form>
WordPress has a lot of useful plugins for sending mails. I would recommend you to check this: https://pl.wordpress.org/plugins/contact-form-7/
If I'm understanding correctly, you need a contact form to send messages from your WordPress page. Plugin above is very good for things like this and it provides possibility to style your form.
I am trying to use a wordpress recaptcha plugin.
The plugin (like wp-recaptcah, better Wp recaptcha) that I am trying to use is only working for the comment form.
But in my case I have created a page and there I have inserted HTML that is managed from the admin panel.
I don't understand how I can use the plugin with my form.
I did not get any shortcode HTML tag to use it directly on the page.
Any suggestion how I can achieve this?
I have created a page in the admin panel and inserted this code. My form is submitted via AJAX:
<div class="First"> Here some static Html is used </div>
<form id="main-form">
<div>
<label>Name</label>
<input class="span6" type="text" maxlength="45" name="name" />
</div>
<div>
<label>Email</label>
<input class="span6" type="text" maxlength="45" name="email" />
</div>
<div>
<label>Phone Number</label>
<input class="span6" type="text" name="phone" placeholder="Enter Phone Number" />
</div>
<div>
<label>Message</label>
<textarea class="span12" name="message" rows="6" ></textarea>
</div>
<div><button class="btn >Send Enquiry</button></div>
</form>
<div class="second">Here some static Html is used </div>
Best suggestion: use Contact Form 7 and Contact Form 7 reCAPTCHA Extension or the Really Simple Captcha plugin, both work well with Contact Form 7.
You'll create the form on the CF7 admin page, then insert it into your WordPress page with a shortcode, which, for many reasons, is much better than writing the form itself in the WordPress text view.
You may use reCAPTCHA Form . It give u a form along with the recaptcha.
http://wordpress.org/plugins/recaptcha-form/
or else you may be wanting the following one instead,
http://wordpress.org/plugins/wp-recaptcha/