Sunday 14 October 2012

how to design feedback form  using   html and php  and with mysql connectivity?
(1)first type this code for  feedback form. save it as feed.php
<html>
<HEAD>
<STYLE >
p{font-family:"Elephant",Times,serif;}
BODY{ BACKGROUND-IMAGE:URL("n.JPG");
.test{
 width=70px;
height=605px;
background-color:yellow;
}
.test:focus
{width=70px;
height=55px;
background-color:silver;
}
</STYLE>
</HEAD>
<body bgcolor=gray  text=black >
<center><FONT  SIZE=5    >
<form action="om.php"   method="post" ><p>
FIRSTNAME:&nbsp;&nbsp;&nbsp;<input type=text  name=fname  size=40  ><br>
<br>

LASTNAME:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=text   name=lname  size=40 ><br>
<br>

CONTACT:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=text  name=contact  size=40><br>
<br>

EMAIL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=text  name=email  size=40><br>
<br>

FEEDBACK<BR>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <textarea name=area  rows=12   cols=70>ENTER        YOUR     COMMENT          HERE!                                                                                                                                         
</textarea><br>
<br>
</FONT></p>
<input type=submit         />
</form>
</center>
</body>
</html>
(2)then type  om.php   file to connect  database  mysql.
<FONT COLOR=BLUE>THANK YOU TO VISIT OUR SITE </FONT>
<?php   echo '<span style="color:blue">';
echo strtoupper( $_POST["fname"]);
echo   "     " ;
echo strtoupper( $_POST["lname"]);
?> 
<?php

 
 $con=mysql_connect("localhost","root","");

 mysql_select_db("abc",$con);

 $sql="INSERT INTO xyz (fname,lname,contact,email,area) VALUES('$_POST[fname]','$_POST[lname]','$_POST[contact]','$_POST[email]','$_POST[area]')";
 
mysql_query($sql);

 ?>



NOTE:- for above you have to install wamp server  software tools and  you run in your browser  
 as   TYPE IN ADDRESS BAR   HTTP:/LOCALHOST/feed.php  then it will automatically call om.php as we have given  in   <form action=om.php>
where as    abc   is database name and  xyz    is table name .


No comments:

Post a Comment