PHP Simple feedback application






feedback.html



<html>

<head>
<title>Feedback  Page</title>
<style type='text/css'>
table {
background:#dedfff;
font-family:verdana;
 }
 .strip{background:#7b869c}
</style>
</head><body>
<form action='savefeed.php' method='post'>
<table align=center>
<tr><td >Name<td ><input   name=txtname></td></tr>
<tr><td >Email    <td ><input name=txtemail></td></tr>
<tr><td >Office address<td ><textarea name=tareaoffice rows=3 cols=30></textarea></td></tr>
<tr><td >Mobile no. <td ><input name=txtmobile></td></tr>
<tr><td >Designation <td ><input name=txtdesignation></td></tr>
<tr><td >Expert areas<td ><input name=txtexpertarea></td></tr>
<tr><td >Comment<td ><textarea name=tareacomment rows=3 cols=30></textarea></td></tr>
<tr class='strip' ><td colspan=2 align="center"><input type='submit' value=submit name='cmdsubmit'><input type='reset' value='clear' name='cmdclr'></td></tr>
</table></form></body></html>




savefeed.php


<?php

if(isset($_POST['txtname']))
{
$cn=mysql_connect('localhost','root');
    mysql_select_db("College",$cn);
   $query="insert into feedback(name,email,addr,phone,desg,expert,comment) values('";
   $query.=$_POST['txtname']."','".$_POST['txtemail']."','".$_POST['tareaoffice']."',".$_POST['txtmobile'].",'".$_POST['txtdesignation']."','".$_POST['txtexpertarea']."','".$_POST['tareacomment']."')";
   $res=mysql_query($query);

    if($res)
     {
     echo "<h3>Thanks! Feedback submitted.</h3>";
     include("http://kbkashid.blogspot.com/");
     }
     else
     {
        echo "<h3>Error! Try again</h3>";
        include("feedback.html");
     }


}
else
{

include("feedback.html");
}
?>


MySQl Queries:
 create database college;

 use college;

 create table feedback(
 fedid BIGINT( 10 ) NOT NULL AUTO_INCREMENT PRIMARY KEY,
 name varchar(20) not null,
 email varchar(20) not null,
 addr varchar(50) not null,
 phone BIGINT(11),
 desg varchar(12),
 expert varchar(20),
 comment varchar(100));

2 comments:

  1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Front end developer learn from Javascript Training in Chennai . or learn thru JavaScript Online Training in India. Nowadays JavaScript has tons of job opportunities on various vertical industry. JavaScript Training in Chennai

    ReplyDelete
  2. Full of heavenly and virtuosic words.
    canon ink

    ReplyDelete

Thanks for visiting my Blog!

Have a Question ? Need Help in College Assignments, Need Code that is not available here? Just leave a comment & get your code instantly.

Tips to Enhance Your Blog