By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,617 Members | 1,896 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,617 IT Pros & Developers. It's quick & easy.

Email - Query

P: 2
Hi,

I did a feedback form in PHP. When i click the submit button, the form is submitted and the mail has been sent successfully and all the fields had been clear. But then if i click the refresh button, automatically a mail is sent with the previous data. Can anyone help me out.

Here is the Code:
-----------------------

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Falcon (c) Security Services - FeedBack</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<META HTTP-EQUIV="Refresh" CONTENT="90; URL=index.htm">
<link href="falcon.css" rel="stylesheet" type="text/css">
<script language="JavaScript"></script>
</head>

<body leftmargin="0" topmargin="0">
<table width="750" border="0" align="center" cellpadding="2" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td height="20" align="right" valign="middle" class="condent"> <a href="index.htm" class="sitelinks">Home</a> | <span>Feed Back</span>&nbsp;&nbsp;</td>
</tr>
</table>
<form name="_ctl0" method="post" action="Reply.php" id="_ctl0">
<table width="95%" border="0" align="center" cellpadding="10" cellspacing="0" id="tblFeedBack">
<tr>
<td align="left" class="content">Name <font color="red">&nbsp;*</font> </td>
<td>
<input name="txtName" id="txtName" type="text" class="textbox" size="25" />
</td>
</tr>

<tr>
<td align="left" class="content">Email ID <font color="red">&nbsp;*</font> </td>
<td>
<input name="txtEmailId" id="txtEmailId" type="text" class="textbox" size="25" />
</td>
</tr>

<tr>
<td align="left" class="content">Telephone <font color="red">&nbsp;*</font> </td>
<td>
<input name="txtTelephone" id="txtTelephone" type="text" class="textbox" size="25" />
</td>
</tr>

<tr>
<td align="left" class="content">Comments <font color="red">&nbsp;*</font></td>
<td>
<textarea name="txtComments" id="txtComments" class="textarea" rows="5" cols="25"></textarea></textarea>
</td>
</tr>

<tr><td> &nbsp; </td></tr>
<tr>
<td colspan = 2 align =center>
<input type="submit" name="btnSubmit" value="Submit" id="btnSubmit" class="content" OnClick="return Add();"/>
<input type="button" value="Clear" OnClick="Clear();" class = "content" name="clear" size="20">
<input type="button" value="Cancel" OnClick="Cancel();" class = "content" name="cancel" size="20">
</td>
</tr>
<?
$to = "pirai@falcon.net.in";
$subject = "Feedback";
$name = $_POST['txtName'] ;
$email = $_POST['txtEmailId'] ;
$telephone = $_POST['txtTelephone'] ;
$message = $_POST['txtComments'] ;
$headers = "From: $email";
$notes = stripcslashes($notes);
$feedback = "$name \n Email: $email \n Telephone: $telephone\n Comments: $message";
$sent = mail($to, $subject,$headers,$feedback) ;
if($sent)
{
print "Your mail was sent successfully";
}
else
{print "We encountered an error sending your mail"; }
?>
</table>
</form>
</body>
</html>

<script language="JavaScript" type="text/JavaScript">
function Add()
{
if (document.getElementById("txtName").value=="")
{
alert("Please Enter the Name")
document.getElementById("txtName").focus();
return false;
}


if (document.getElementById("txtEmailId").value=="")
{
alert("Please Enter the Email ID")
document.getElementById("txtEmailId").focus();
return false;
}
if (document.getElementById("txtTelephone").value=="" )
{
alert("Please Enter the Telephone")
document.getElementById("txtTelephone").focus();
return false;
}
if (document.getElementById("txtComments").value=="")
{
alert("Please Enter the Comments")
document.getElementById("txtComments").focus();
return false;
}

var PhoneNumber = /^[0-9\+\,\(\)\-\s]+/gi;
if(document.getElementById("txtTelephone").value!= "")
{
if(!PhoneNumber.test(document.getElementById("txtT elephone").value))
{
alert("* Phone Number accepts numbers and Special Characters.");
document.getElementById("txtTelephone").focus();
return false;
}
}
var EmailId = /^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]+/gi;

if(EmailId.test(document.getElementById("txtEmailI d").value) == false)
{
alert("* Please Enter Valid Email ID.");
document.getElementById("txtEmailId").focus();
return false;
}

}

function Clear()
{
document.getElementById("txtName").value = "";
document.getElementById("txtEmailId").value = "";
document.getElementById("txtTelephone").value = "";
document.getElementById("txtAddress").value = "";
document.getElementById("txtCity").value = "";
document.getElementById("txtCountry").value = "";
document.getElementById("txtComments").value = "";
}
function Cancel()
{
window.location.href("index.htm")
}
</script>
Nov 2 '06 #1
Share this Question
Share on Google+
4 Replies


100+
P: 268
POst values are not set as null so again the same date send.
When post the vaklues and POSt array set as null not send the same values

Vssp
Nov 2 '06 #2

ronverdonk
Expert 2.5K+
P: 4,258
Read the Posting Guidelines before you put anything here. For you: read the part about enclosing your code in code, php or html tags!!

Until then, I will not look at your code, it is absolutely unreadable!

Ronald :cool:
Nov 3 '06 #3

P: 2
Read the Posting Guidelines before you put anything here. For you: read the part about enclosing your code in code, php or html tags!!

Until then, I will not look at your code, it is absolutely unreadable!

Ronald :cool:
Hi, Mr.Ronald am new to this Forum. So i donno the guidelines of how to post the questions here. You need not look at my code. Thanks for ur kind reply.
Nov 6 '06 #4

ronverdonk
Expert 2.5K+
P: 4,258
Well, the first entry in this forum RIGHT AT THE TOP, contains these guidelines. You haven't been to many forums I presume, because they all have these guidelines and all of them want the shown code within tags.

So you don't want me to look at your code. Do you mean you want your thread deleted??

Ronald :cool:
Nov 6 '06 #5

Post your reply

Sign in to post your reply or Sign up for a free account.