Easy Breeze in Web Design
Currently Browsing: Free Web Design Guides

How to Install WordPress to My Web Host

Introduction

WordPress is a simple to use and install program that makes developing and editing websites a simple task that almost anyone can use with competence.  Blogs and even major websites can easily be edited by using WordPress that allows you to edit web content from almost anywhere; this is a simple step by step guide that will walk you through the process of how to install WordPress to the root of your website’s domain.

 

Step 1: Downloading and Unzipping

The first step to installing WordPress onto your site is to obtain a copy of the software.  The relatively small sized file (3.0 MB) can be downloaded for free from WordPress.org.  Once the zipped file has been downloaded it is necessary to unzip using Winrar or some other similar program.

 

Step 2: Creating the Database and a User

If your site is hosted by a hosting provider it is important to check to see if it is already installed in which case it will not be necessary to install WordPress.  Most hosting providers use cPanel as its main interface with your site, this step will walk you through the process of configuring it to install WordPress as the editing tool.

  1. Log into cPanel
  2. Click MySQL the Database Wizard icon found beneath the databases area.
  3. Insert the name of the database and click next step
  4. Create database users by entering the database username and password, then click create user.
  5. Add user to Database by clicking the “all privileges” checkbox and click the next step button.
  6. Complete the task by noting the database name and user, make sure to record the hostname, username, database name, and the password.

 

Step 3: Setting up wp-confic.php

To install WordPress it is necessary to go back to the files that you downloaded and unzipped, look for the file “wp-config-sample.php” and rename it as “wp-config.php” and open it in the text editor of your choice.  You now need to enter your database information in the necessary fields such as “database_name” for the name of the database which you used, “database_user” for the user which you assigned to the database and “database_password” for the password which you assigned to the user. Zip the files and name it as WordPress.

 

Step 4: Uploading the Files

Using your FTP client upload the zipped file and extract it to the directory where your domain is pointing at. Make sure that the files were unzipped properly.

 

Step 5: Running the Installation Script

Using the web browser of your choice enter the URL of your site with the proper extensions as shown in the following example, http://example.com/wp-admin/install.php .  All that is necessary now is to enter the proper information in the fields of this page and you’re all done.

 


How to Create Contact Form in PHP and Email Form Results

Forms are very useful in getting information from your website readers. Your form can be a survey form, a contact contact us form or even a multiple choice question and answer. To get the answers from the online forms which your readers submitted, you can receive the results via email. In our example, we will teach you how to create a contact form in PHP and email form results.

Basically, you will need an HTML script to create the form and PHP script that will catch the results from the forms and send it to your email. In our example, we will use a contact form that will send the results to email.

Below is the HTML code for contact form. You may edit this depending on fields that you need for your website. The code “send_email.php” refers to the file name of the php script that you will use. Make sure that your PHP file will be the same with this one.

<form action=”send_email.php” method=”post” name=”contactform”>
<table width=”557″>
<tbody>
<tr>
<td valign=”top”>
<label for=”first_name”>First Name *</label>
</td>
<td valign=”top”>
<input type=”text” name=”first_name” size=”30″ maxlength=”50″/>
</td>
</tr>
<tr>
<td valign=”top”>
<label for=”last_name”>Last Name *</label>
</td>
<td valign=”top”>
<input type=”text” name=”last_name” size=”30″ maxlength=”50″/>
</td>
</tr>
<tr>
<td valign=”top”>
<label for=”email”>Email Address *</label>
</td>
<td valign=”top”>
<input type=”text” name=”email” size=”30″ maxlength=”80″/>
</td>
</tr>
<tr>
<td valign=”top”>
Your age
</td>
<td valign=”top”>
<input type=”text” name=”age” size=”30″ maxlength=”30″/>
</td>
</tr>
<tr>
<td valign=”top”>
Message
</td>
<td valign=”top”>
<textarea style=”width: 374px; height: 130px;” name=”experience” rows=”6″ cols=”25″></textarea>
</td>
</tr>
<tr>
<td style=”text-align: center;” colspan=”2″>
<input type=”submit” value=”Submit”/>
</td>
</tr>
</tbody>
</table>
</form>

The output of the code above will be:

Your age
Message

 

So that you can receive the results to your email, you will need the PHP script below. Open a notepad and save it using the file name “send_email.php”. You may change this provided that you also change the file name indicated in the HTML code. Make sure that the file name extension .php remains

<?php
if(isset($_POST['email'])) {

// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = “enteryouremailhere@email.com”;
$email_subject = “Contact form results”;

function died($error) {
// your error code can go here
echo “We are very sorry, but there were error(s) found with the form you submitted. “;
echo “These errors appear below.<br /><br />”;
echo $error.”<br /><br />”;
echo “Please go back and fix these errors.<br /><br />”;
die();
}

// validation expected data exists
if(!isset($_POST['first_name']) ||
!isset($_POST['last_name']) ||
!isset($_POST['email']) ||
!isset($_POST['age']) ||
!isset($_POST['message'])) {
died(‘We are sorry, but there appears to be a problem with the form you submitted.’);
}

$first_name = $_POST['first_name']; // required
$last_name = $_POST['last_name']; // required
$email_from = $_POST['email']; // required
$age = $_POST['age']; // not required
$message = $_POST['message']; // required
$chk = $_POST['chk ']; // required

$error_message = “”;
$email_exp = ‘/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/’;
if(!preg_match($email_exp,$email_from)) {
$error_message .= ‘The Email Address you entered does not appear to be valid.<br />’;
}
$string_exp = “/^[A-Za-z .'-]+$/”;
if(!preg_match($string_exp,$first_name)) {
$error_message .= ‘The First Name you entered does not appear to be valid.<br />’;
}
if(!preg_match($string_exp,$last_name)) {
$error_message .= ‘The Last Name you entered does not appear to be valid.<br />’;
}
if(strlen($message) < 2) {
$error_message .= ‘The message you entered do not appear to be valid.<br />’;
}
if(strlen($error_message) > 0) {
died($error_message);
}
$email_message = “Form details below.\n\n”;

function clean_string($string) {
$bad = array(“content-type”,”bcc:”,”to:”,”cc:”,”href”);
return str_replace($bad,”",$string);
}

$email_message .= “First Name: “.clean_string($first_name).”\n \n”;
$email_message .= “Last Name: “.clean_string($last_name).”\n \n”;
$email_message .= “Email: “.clean_string($email_from).”\n \n”;
$email_message .= “age: “.clean_string($age).”\n \n”;
$email_message .= “message: “.clean_string($message).”\n \n”;

// create email headers
$headers = ‘From: ‘.$email_from.”\r\n”.
‘Reply-To: ‘.$email_from.”\r\n” .
‘X-Mailer: PHP/’ . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
?>

<!– include your own success html here –>
<h1>Message Sent!</h1>
<p>Thank you your interest in joining us! We will respond to you as soon as we have evaluated your application. Further instructions will be sent to your email. Please check your email regularly.</p>
<p>Have a great day ahead of you!</p>
<?php
}
?>


Designed by Affordable Web Design Guide | Copyright 2011