How To Create Contact Form Using PHP
Submitted by alpha_luna on Saturday, April 23, 2016 - 14:59.
Related Code: User Registration Form Using PHP
In this tutorial, we are going to learn on How To Create Contact Form Using PHP. We have a contact form in the example below for the user to send their message, suggestions, questions, feedback, and clarifications about your work or your website.
We have three fields as full name, email, and message in our contact form. This is a very simple tutorial, hope you will find this useful.
Contact Form - HTML
This source code for our contact form.
Data Table
This is the data where the user message shows in this table.
And, we have CSS style.
Contact Form Input Into Database
This is PHP query where our data store in the database. First, create a database table, name into "contact_form".
After executing the query code above it will be added to the database, this is the result.
Related Code: User Registration Form Using PHP
Share us your thoughts and comments below. Thank you so much for dropping by and reading this tutorial post. For more updates, don’t hesitate and feel free to visit this website more often and please share this with your friends or email me at [email protected]. Practice Coding. Thank you very much.
- <table border="1" class="table_data" cellspacing="5" cellpadding="5">
- <tr style="color:blue;">
- <th>
- Full Name
- </th>
- <th>
- Email
- </th>
- <th>
- Message
- </th>
- </tr>
- <?php
- $result= mysql_query("select * from tbl_contact order by tbl_contact_id DESC ") or die (mysql_error());
- $id=$row['tbl_contact_id'];
- ?>
- <tr style="text-align:center; color:blue;">
- <td style="width:200px;">
- <?php echo $row['fullname']; ?>
- </td>
- <td style="width:200px; color:red;">
- <?php echo $row['email']; ?>
- </td>
- <td style="width:200px; color:blue;">
- <?php echo $row['user_message']; ?>
- </td>
- </tr>
- <?php } ?>
- </table>
- table {
- border:yellow 5px solid;
- }
- .table_data {
- margin-left: 291px;
- margin-top: 20px;
- }
- .tableheader {
- background-color: maroon;
- color: white;
- font-weight: bold;
- font-size: 25px;
- }
- .tablerow {
- background-color: black;
- color: white;
- font-size: 20px;
- font-weight: bold;
- }
- .aler_message {
- color: #FF0000;
- font-weight: bold;
- text-align: center;
- width: 100%;
- cursor:pointer;
- }
- .text_input {
- font-size: 18px;
- border: blue 1px solid;
- background: azure;
- text-indent: 10px;
- cursor:pointer;
- }
- .btn_submit {
- font-size: 18px;
- width: 100px;
- background: azure;
- border: blue 1px solid;
- padding: 6px;
- border-radius: 8px;
- color: blue;
- cursor:pointer;
- }
- .btn_submit:hover {
- font-size: 18px;
- width: 100px;
- background: azure;
- border: re 1px solid;
- padding: 6px;
- border-radius: 8px;
- color: red;
- cursor:pointer;
- }
- mysql_query("INSERT INTO tbl_contact (fullname, email, user_message) VALUES ('" . $fullname. "', '" . $email. "','" . $user_message. "')");


Add new comment
- 285 views