Codeasearch.com - Search your code with us Login | Register | Contact us
  Forums > Html > feedback form required with html code
charan1007
Posted on May 27, 2009
Join Date: April 2009
Location: India ( delhi )
Posts: 4
 
feedback form required with html code  

hi

i need a feedback form with html code (whcih easy to put on web with good feel look of buttons. thanks

benaya
Posted on May 27, 2009
Join Date: June 2007
Location: India ( Chennai )
Posts: 90
 
RE : feedback form required with html code  

Hi,
I am giving you source for php feedback file.
Create first file name as "feedback.php" code here.

<?php ini_set("display_errors",0);?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Feedback form</title>
<script language="javascript">
function trim(str){ return str.replace(/^\s+|\s+$/g,''); }
function isEmail(objField){ if(objField.value.length > 0){ if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(objField.value)){ return true; } } alert("Invalid E-mail Address! Please re-enter."); objField.select(); return false; }
function frmFeedbackValidation() {
if(trim(document.getElementById("txtName").value)=="") {
alert("Please enter the Name");
document.getElementById("txtName").focus();
return false;
}
if(trim(document.getElementById("txtEmailid").value)=="") {
alert("Please enter the EmailId");
document.getElementById("txtEmailid").focus();
return false;
}
if(isEmail(document.getElementById("txtEmailid"))==false) {
document.getElementById("txtEmailid").focus();
return false;
}
if(trim(document.getElementById("txtComments").value)=="") {
alert("Please enter the Comments");
document.getElementById("txtComments").focus();
return false;
}

}
</script>
</head>

<body>
<?php if($_REQUEST["msg"]=="sent") { ?>
<table>
<tr>
<td>
Thank you for your feedback.<br /> We will contact you soon.
</td>
</tr>
</table>
<?php } else { ?>
<table>
<form name="frmFeedback" id="frmFeedback" action="feedback_server.php" onsubmit="return frmFeedbackValidation();">
<tr>
<td>Name *</td>
<td><input type="text" name="txtName" id="txtName" maxlength="50" /></td>
</tr>
<tr>
<td>EmailId *</td>
<td><input type="text" name="txtEmailid" id="txtEmailid" maxlength="150" /></td>
</tr>
<tr>
<td valign="top">Comments *</td>
<td><textarea name="txtComments" id="txtComments" cols="40" rows="8"></textarea></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="btnSubmit" value="Submit" />
&nbsp;&nbsp;<input type="reset" name="btnSubmit" value="Reset" /></td>
</tr>
</form>
</table>
<?php } ?>
</body>
</html>


------------------------------------------------
Now create second file as "feedback_server.php" code here.
------------------------------------------------
<?php
$strBody = "<br /><br />
<table>
<tr>
<td>Name </td>
<td>".$_POST["txtName"]."</td>
</tr>
<tr>
<td>EmailId *</td>
<td>".$_POST["txtEmailid"]."</td>
</tr>
<tr>
<td valign=\"top\">Comments *</td>
<td>".$_POST["txtComments"]."/td>
</tr>
</table>";

$headers = "From: ".$_POST["txtEmailid"]."\r\n";
$headers .= "Content-type: text/html\r\n";

//Change your email address here
$strTo = "benayapaul@gmail.com";
$strSubject = "You have a feedback ";


@mail($strTo,$strSubject,$strBody,$headers);

header("Location: feedback.php?msg=sent");
?>


If you have any doubts let me know.

 Hot Discussion
Go Tech launches Android tablet for Rs 3,999...
Sony targets retailers with quick sales pitches and rew...
Share and discover new activities with Google Schemer...
Samsung gets 9 mn preorders for Galaxy S3: Report...
Google revamps search engine to think like a person...
 
 Discussion Topics
IT News
Php
Javascript
Technology Updates
Asp.Net
MySql
Ajax
Html
Fedora
Software Testing
Asp
Java
General
Flash
Ruby on Rails