Send email with php for wordpress page - php

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.

Related

Should I change my HTML Contact Form to PHP in order for it to work or do I need to fix the Server?

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>

Sending Bootstrap Form Data To Email Address

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.

converting web page to pdf in protected members area with pdfmyurl

I'm using the pdfmyurl api to convert web pages to PDF. This works fine for all pages on my website, which are not in the members area. My members area requires a user to log in first.
According to the documentation (http://pdfmyurl.com/html-to-pdf-api#secure) I should be able to pass form fields so their converter can access the page. However when I try this, I still get a PDF of the login page.
My login form (http://members.mysite.com/login.php) has the following HTML:
<form class="form-horizontal" id="memberlogin" action="checkpass.php" method="post">
<div class="control-group">
<label class="control-label" for="user">Username:</label>
<div class="controls">
<input name="user" id="user" required>
</div>
</div>
<div class="control-group">
<label class="control-label" for="password">Password:</label>
<div class="controls">
<input type="password" id="password" name="password" required>
</div>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary">Sign in</button>
</div>
</form>
And in the checkpass.php script I only check for the values of user and password.
I'm using the following API call:
http://pdfmyurl.com/api?license=mylicense&url=http://members.mysite.com/mypage.php&form_url=http://members.site.com/login.php&form_fields[user]=username&form_fields[password]=password
I'm confident the password for the user is correct as I can manually log in. I'm pretty sure this is also how I should pass an array over HTTP GET.
Any ideas?
Your form page is http://members.mysite.com/login.php, but you check the login parameters at http://members.site.com/checkpass.php
I think PDFmyURL will need to pass the login parameters to http://members.site.com/checkpass.php, because that's where you check them.
Try the following API call to do this
http://pdfmyurl.com/api?license=mylicense&url=http://members.mysite.com/mypage.php&form_url=http://members.site.com/checkpass.php&form_fields[user]=username&form_fields[password]=password
Other than this you must check server logs to find problems with authentication.

PHP and my current HTML w/ CSS files [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
This question will more than likely result in an easy answer, however I am at a roadblock until hopefully someone can help, as I am new to PHP.
So I had a basic registration page in HTML and styled in CSS for my website, however it obviously did nothing. So I acquired the necessary PHP files to make it all work, and tested the PHP on a localserver and it was excellent as anticipated.
However my question is, how can I bring the functionality of the PHP into my already created SignUp.html page?
Or do I need to somehow style the PHP and scrap my current html and css files?
I'll attach my current basic html code in the event that helps.
<h2>Sign Up</h2>
<div id="form-data">
<fieldset>
<div class="fieldgroup">
<label for="name"> Username</label>
<input type="text" name="name">
</div>
<div class="fieldgroup">
<label for="name">First Name</label>
<input type="text" name="name">
</div>
<div class="fieldgroup">
<label for="name">Last Name</label>
<input type="text" name="name">
</div>
<div class="fieldgroup">
<label for="email">Email</label>
<input type="text" name="email">
</div>
<div class="fieldgroup">
<label for="password">Password</label>
<input type="password" name="password">
</div>
<div class="fieldgroup">
<p class="right">By clicking register you agree to our <a target="_blank" href="#">policy</a>.</p>
<input type="submit" value="Sign up" class="submit">
</div>
</fieldset>
</div>
Rename the .html file to the .php extension and then put the PHP code into it.
Probably something like:
if(isset($_POST['sent']))
{
// PROCESS FORM IN PHP HERE
}
will help you when modifying the submit button to:
<input type="submit" name="sent" value="Sign up" class="submit">
You can change the extension of the .html files to .php to bring the functionality of PHP to your files. The HTML will still be treated as HTML, so there is no need to change the HTML markup if you change the extension.
You can also "instruct Apache to treat .html as PHP." as #Fred-ii- said.
For running the form through PHP, you can either direct the form to a .PHP file like so:
<form action="phpfile.php" method="*post OR get*">
or you can run it on the page the form is on like so:
<form action="" method="*post OR get*">
<!-- Form Contents Here -->
</form>
<?php
if(isset($_POST['submit'])) {
// PHP code here
}
?>

Wordpress Recaptcha use on form that created using page

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/

Categories