PHP Feedback form not working........?

Status
Not open for further replies.

satyamy

Alive Again...
I created one feedback form some time before at that time it was working
but now i dont know what happened it is not working
It is attached here
Can someone findout whats wrong in it..........?
Pls help me
 

mediator

Technomancer
I didn't check the working yet.
AFAIK, u have to fill the mail server u will be using too! Did u disable ur mail server?
 
OP
satyamy

satyamy

Alive Again...
Yes
long long ago
I was searching for Feedback form Code
so i refered this thread
*www.thinkdigit.com/forum/showthread.php?t=45865
*www.thinkdigit.com/forum/showthread.php?t=44053

*www.thinkdigit.com/forum/showthread.php?t=43943

*www.thinkdigit.com/forum/showthread.php?t=42803&highlight=contact+us

but didnt find any solution
but finally
with the help of my friend Amitava
i got the correct feedback form code
but at that time i didnt have any website
now i created one website but that code is not working i have attached it here
Pls help me...........
 

nileshgr

Wise Old Owl
satyamy said:
Yes
long long ago
I was searching for Feedback form Code
so i refered this thread
*www.thinkdigit.com/forum/showthread.php?t=45865
*www.thinkdigit.com/forum/showthread.php?t=44053

*www.thinkdigit.com/forum/showthread.php?t=43943

*www.thinkdigit.com/forum/showthread.php?t=42803&highlight=contact+us

but didnt find any solution
but finally
with the help of my friend Amitava
i got the correct feedback form code
but at that time i didnt have any website
now i created one website but that code is not working i have attached it here
Pls help me...........
I have also tried it on my site. It gives some redirection error. I checked the PHP code, still i dont find any error in it. Can you give some screenshot of the error. I use Opera, so it auto-redirects.
 
OP
satyamy

satyamy

Alive Again...
thanks a lot my dear friends
but again with the help my Friend Amitava i got the correct feedback form & it started working

Actually I wanted a Form in which their must be column Name, Email & Comment
& when a user fill the form & press submit than it mails the whole detail to my email id
So now i got the form
Now i am making a Javascript
so that if their is any field left blank than it will tell the user abt this before going to internet
anyways thanks

here's the codes

feedback.html
<HTML>
<HEAD>
<TITLE> Feedback </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">

<!-- CSS Begin //-->
<STYLE type=text/css>

.f8 {FONT-SIZE: 8pt; FONT-FAMILY: arial}
.f9 {FONT-SIZE: 9pt; FONT-FAMILY: arial}
.f10 {FONT-SIZE: 10pt; FONT-FAMILY: arial}
.f11 {FONT-SIZE: 11pt; FONT-FAMILY: arial}

</STYLE>
<!-- CSS Ends //-->

</HEAD>

<BODY text=#000000 vLink=#d14F8F aLink=#005DA4 link=#005DA4 bgColor=#ffffff
leftMargin=0 topMargin=0 marginwidth="0" marginheight="0">
<TABLE cellSpacing=0 cellPadding=0 width=778 border=1>
<TBODY>
<TR>
<TD height=60 width="20"></td>
<TD height=60 width="738">
<img src="images/logo.gif"></img></TD>
<TD height=60 width="20"></td>
</TR>
</TBODY>
</table>
<TABLE cellSpacing=0 cellPadding=0 width=778 border=1>
<tbody>
<TR>
<TD height=30 width=778 bgcolor=999999 colspan=4></TD>
</TR>
<TR>
<TD width=778 height=25 bgcolor=CCCCCC style="BORDER-TOP: #ffffff 1px solid" class=f10 align="center" vAlign="center" colspan=4> FEEDBACK FORM
</TD>
<tr>
<TD width=778 height=300 bgcolor=CCCCCC class=f10 align="center" vAlign="top">
<br>
<form name="feedback" method="POST" action="feedback.php">
Name <input name="name" type="text"><br><br>
Email&nbsp; <input name="email" type="text"><br><br>
Phone <input name="phone" type="text"><br><br>
Feedback&nbsp;&nbsp;&nbsp;&nbsp; <textarea name="comments"></textarea><BR><br>
<input name="formbutton" type="submit" value="Submit">
<input name="formbutton2" type="reset" value="Reset">
</form>
</TD>
<tr>
</TR>
<TR>
<TD width=778 height=30 valign="top" bgcolor=999999 colspan=4>
</TD>
</TR>
</BODY>
</HTML>

feedback.php
<?

// ------------- CONFIGURABLE SECTION ------------------------

// $mailto - set to the email address you want the form
// sent to, eg
//$mailto = "youremailaddress@example.com" ;

$mailto = 'youremailaddress@example.com' ;

// $subject - set to the Subject line of the email, eg
//$subject = "online contact form" ;

$subject = "online contact form" ;


$formurl = "feedback/form.html" ;
$errorurl = "feedback/error.html" ;
$thankyouurl = "feedback/thankyou.html" ;

// -------------------- END OF CONFIGURABLE SECTION ---------------

$name = $_POST['name'] ;
$email = $_POST['email'] ;
$phone = $_POST['phone'] ;
$comments = $_POST['comments'] ;

$http_referrer = getenv( "HTTP_REFERER" );

if (!isset($_POST['email'])) {
header( "Location: $formurl" );
exit ;
}
if (empty($name) || empty($email) || empty($phone) || empty($comments)) {
header( "Location: $errorurl" );
exit ;
}
$name = strtok( $name, "\r\n" );
$email = strtok( $email, "\r\n" );
if (get_magic_quotes_gpc()) {
$comments = stripslashes( $comments );
}

$messageproper ="This message was sent from:\n" .
"$http_referrer\n" .

"NAME:\n" .
$name .
"\n" .
"\n" .
"EMAIL ID:\n" .
$email .
"\n" .
"\n" .
"PHONE NO:\n" .
$phone .
"\n" .
"\n" .

"------------------------- Enquiry -------------------------\n\n" .
$comments .
"\n\n------------------------------------------------------------\n" ;

mail($mailto, $subject, $messageproper, "From: \"$name\" <$email>\r\nReply-To: \"$name\" <$email>\r\nX-Mailer: chfeedback.php 2.04" );
header( "Location: $thankyouurl" );
exit ;

?>

error.html
error!!!. please fill in the details

thankyou.html
Thank you. we will get in touch with you shortly.

Zeeshan Quireshi said:
hey satyam can u tell me exactly what u want ur feedback form to do , then i'll programm one for ya .
thanks for the help
i have created one form which has javascript in it
so when a user press sumbit it identify which field is blank & which one is wrong
& at the same time give the error
but the form which i have given here use internet
i.e.
after pressing sumbit it sumbit the form use internet connection check & tells the error

can you tell me how i can integrate both form

So that at pressing submit button the person get error about the blank field without using internet connection

because this will save time
:)

here's the code for Javascript Form
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<script language="JavaScript">
<!--
function validate()
{
n1=document.form1.txt_name.value
p1=document.form1.txt_phone.value
e1=document.form1.txt_email_id.value
c1=document.form1.txt_comment.value


if(n1=="")
{
alert("Enter Your Name")
document.form1.txt_name.focus();
return false
}
else
{
for(i=0;i<n1.length;i++)
{
if ((n1.charAt(i)>'Z') && (n1.charAt(i)<'a') || (n1.charAt(i)<'A') ||
(n1.charAt(i)<'A'))
{
alert("Enter a Valid Name")
document.form1.txt_name.focus()
return false
}
}
}



if(p1=="")
{
alert("Enter Your Phone Number")
document.form1.txt_phone.focus();
return false
}
else
{
for(j=0;j<p1.length;j++)
{
if
((p1.charAt(j)<'0' || p1.charAt(j)>'9'))
{
alert("Enter a Valid Phone Number")
document.form1.txt_phone.focus()
return false
}
if (p1.length!=12 && p1.length!=8)
{
alert("Phone Number Must Contain 8 or 12 digit only")
document.form1.txt_phone.focus()
return false
}
}
}


if(e1=="")
{
alert("Enter Your Email ID")
document.form1.txt_phone.focus();
return false
}

if(c1=="")
{
alert("Please Enter Your Message")
document.form1.txt_phone.focus();
return false
}
}





-->
</script>
</HEAD>

<BODY>
<form id="contactus_form" action="feedback.php" method="post" name="form1">
<div align="center"><br>
&nbsp;&nbsp;&nbsp;<span class="fstyle">Name</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input name="txt_name" type="text" class="textfield" id="name" value="" size="25" maxlength="255">
<br>
<br>
&nbsp;&nbsp;&nbsp;<span class="fstyle">Phone </span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input name="txt_phone" type="text" class="textfield" id="name" value="" size="25" maxlength="255">
<br>
<br>
&nbsp;&nbsp;&nbsp;<span class="fstyle">Email ID </span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input name="txt_email_id" type="text" class="textfield" id="name" value="" size="25" maxlength="255">
<br>
<br>
&nbsp;&nbsp;&nbsp;<span class="fstyle">Website</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input name="txt_website" type="text" class="textfield" id="name" value="" size="25" maxlength="255">
<br>
<br>
&nbsp;&nbsp;&nbsp;<span class="fstyle">Comment</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<textarea name="txt_comment" cols="25" rows="3" class="fstyle" id="name"></textarea>
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
<input type="submit" name="Button" value="Submit" onClick="validate()";>
&nbsp;
<input type="reset" name="submit2" value="Reset">
</div>
</FORM>
</BODY>
</HTML>
 
Last edited:

Sukhdeep Singh

Host4Cheap.org
Why not make a form using PHP Form Generator. You can easily install using Fantastico which might be there in your cPanel.

If not Download and run it from *phpformgen.sourceforge.net/
 

Zeeshan Quireshi

C# Be Sharp !
well i think it would be btter if u checked for empty fields coz many ppl these days hv javascript disabled in their browser n it can easily be bypassed , checking it on the server level is the best option .
 

nileshgr

Wise Old Owl
Zeeshan Quireshi said:
well i think it would be btter if u checked for empty fields coz many ppl these days hv javascript disabled in their browser n it can easily be bypassed , checking it on the server level is the best option .
You are right. If Satayam wouldn't have got hlp; i would have programmed a simple feedback form in PHP for him. It wud have no js. Complete Server Side validation.
 

ahref

In the zone
Zeeshan Quireshi said:
well i think it would be btter if u checked for empty fields coz many ppl these days hv javascript disabled in their browser n it can easily be bypassed , checking it on the server level is the best option .

I don't think many people disable js, as all web 2.0 sites are dependent on js, and ajax is also dependent on js.

However in bots js is disabled.
 

Zeeshan Quireshi

C# Be Sharp !
ahref said:
I don't think many people disable js, as all web 2.0 sites are dependent on js, and ajax is also dependent on js.

However in bots js is disabled.

well mate even if 1% ppl hv js disabled then it's a prob , y not check on server which is 100% guaranteed to work .
 

Sukhdeep Singh

Host4Cheap.org
sukhdeepsinghkohli said:
Why not make a form using PHP Form Generator. You can easily install using Fantastico which might be there in your cPanel.

If not Download and run it from *phpformgen.sourceforge.net/

I will still stay with this :)
 

ahref

In the zone
Zeeshan Quireshi said:
well mate even if 1% ppl hv js disabled then it's a prob , y not check on server which is 100% guaranteed to work .

To use on server side is good, but doing it for 1% people I don't agree, there are more than 1% people who don't use cookies, but cookies plays important part in functioning of many sites. No one cares for those 1%.

Even adsense and adwords login did not work, if js is disabled. You have to enable it if you want to use it.
 
OP
satyamy

satyamy

Alive Again...
sukhdeepsinghkohli said:
Why not make a form using PHP Form Generator. You can easily install using Fantastico which might be there in your cPanel.

If not Download and run it from *phpformgen.sourceforge.net/

ohh yes thanks found Fantastico mila in my cpanel

I will test every thing you friends are tell & will mail the final result & what i have selected
 

nileshgr

Wise Old Owl
satyamy said:
ohh yes thanks found Fantastico mila in my cpanel

I will test every thing you friends are tell & will mail the final result & what i have selected
Mail?? How??
 
Status
Not open for further replies.
Top Bottom