creating a feedback form

Status
Not open for further replies.

jay_bo

Daemon Poster
Messages
889
i have been creating a feedback form and i am stuck i cant get it to send the comments to my email address.i want them to send there comments to my email-address with out using there email address.

Where have i gone wrong?

<form action="" enctype="Text/plain" name="form" id="form">
<input type="hidden" name="next_url" value="www.mysite.co.uk" />
<input name="To" type="hidden" id="To" value="my emailaddress is here" />
<input name="Subject" type="hidden" id="Subject" value="Comments" />
<input name="From" type="hidden" id="From" value="myotheremailaddress is here" />


<table width="466" height="315" border="0" cellspacing="8" id="comment form">
<tr>
<td width="95" height="28"><div align="right">First Name </div></td>
<td colspan="3"><label>
<input name="First Name" type="text" id="First Name" maxlength="20" />
</label></td>
</tr>
<tr>
<td height="24"><div align="right">Last Name </div></td>
<td colspan="3"><label>
<input name="Last Name" type="text" id="Last Name" maxlength="30" />
</label></td>
</tr>
<tr>
<td height="24"><div align="right">Gender</div></td>
<td colspan="3"><label>
<select name="ResList" id="ResList">
<option value="Male" selected="selected">Male</option>
<option value="Female">Female</option>
</select>
</label></td>
</tr>
<tr>
<td height="24"><label>
<div align="right">Email Address </div>
</label></td>
<td height="24" colspan="3"><label>
<input name="Email" type="text" id="Email" size="25" maxlength="50" />
</label></td>
</tr>
<tr>
<td height="24" colspan="4"><label>
<input type="CHECKBOX" name="subscribe" checked />
Subscribe me to the Newsletter </label></td>
</tr>
<tr>
<td height="50"><label></label> <div align="right">Comments</div>


</p>


</p>
<label></label></td>
<td height="50" colspan="3"><textarea name="Email " cols="45" rows="6" id="Email "></textarea></td>
</tr>
<tr>
<td height="24"></td>
<td width="56"><input type="submit" name="Submit" value="Submit" /></td>
<td width="48"><input name="Reset form" type="reset" id="Reset form" /></td>
<td width="219"></td>
</tr>
</table>
</form>


Please help thanks
oyea because i have created the form myself do i need a form processor? if so please help i dont want any banners on them:D
 
jay_bo

What you have posted is just the "front end". You also need to add the active back end (.cgi, .asp, .php...depending on the platform) code that resides on your server to process your forms.


One of the first lines in the front end should call this backend code to process your form.
Code:
<form enctype="multipart/form-data" [color=blue]action="formmail.php" [/color]method="post">

Your back end code or the code that resides on your server and process the form can very. There is a lot of free and easy stuff out there you can download. I can post or email you a long example of this.

Cheers,
Williwaw
thLavaLampSmall_anim.gif
 
I'd go with PHP, it's pretty easy. Here's an example:

Code:
<?php 

$message="Name: {$_POST['First Name']}
";
$message = stripslashes($message);

mail("YOUR EMAIL","THE EMAIL SUBJECT",$message); 

echo "Thank you for submitting feedback!";



?>

Okay, now. If you save the above code as something like "process.php" and throw it in the same directory as your feedback form is in, and then enter something into the 'First Name' field, and hit submit, it will send it to the email that you provided in the 'process.php'.

But first, you ahve to set your action to call upon the 'process.php' as "williwaw" said.

That's probably a little confusing.... if you have any more questions, I'll try to help.

Also: your server needs to support the PHP mail function for this to work.
 
okay i dont think i will be able to do it would anyone be able to make me one with the following fields: First Name, Last Name, There email address which i dont want them to put in unless they want a reply or subscribe to a newsletter and then the comments and a submit and reset button. I know you will need my email address but would you just put in "youremailaddresshere"

i just dont get what to do on the directory folder and how the php links to the html page

thanks
 
Here you go:

The html file:
Code:
<html>
<body bgcolor="#000000">


<form method="post" action="process.php">
<center>




	<table border="1" bordercolor="#2d2d2d" cellpadding="3" width="70%">

		<tr>
			<td align="center"><font color="#ffffff" face="Arial" size="2">First Name:</font></td>
			<td align="center"><input type="text" name="firstname" /></td>
		</tr>

		<tr>
			<td align="center"><font color="#ffffff" face="Arial" size="2">Last Name:</font></td>
			<td align="center"><input type="text" name="lastname" /></td>
		</tr>

		<tr>
			<td align="center"><font color="#ffffff" face="Arial" size="2">e-Mail:</font></td>
			<td align="center"><input type="text" name="email" /></td>
		</tr>

		<tr>
			<td align="center"><font color="#ffffff" face="Arial" size="2">Comments:</font></td>
			<td align="center"><textarea cols="16" rows="5" wrap></textarea></td>
		</tr>
	</table>


			<input type="submit" name="submit" value="Submit" />
			<input type="reset" name="reset" value="Reset" />
</center>

	
</body>
</html>

And the PHP file:

Code:
<?php 

$message="First Name: {$_POST['firstname']}           // This is where you tell the PHP script which input fields to enter into
Last Name: {$_POST['lastname']}						  // the email. 
e-Mail: {$_POST['email']}							  
Comments: {$_POST['comments']}
";

$message = stripslashes($message);					 // Don't worry about this, leave it be.

mail("YOUR EMAIL","THE EMAIL SUBJECT",$message);     // Change "YOUR EMAIL" to your email address, and change "THE EMAIL SUBJECT"
													 // to what you want the subject to be called.


echo "Thank you for submitting feedback!";           // This will post a line of text on a blank white page after pressing
													 // the 'Submit' button. You can change the text between the quotes, or,
													 // delete the line altogether.

header("Refresh: 0;url=YOUR SITE URL/");             // This will automatically redirect to your site URL after you press the 
													 //	'Submit' button. The '0' indicates how long it will take to redirect.


?>


EDIT: Download link


Hope I helped. :)
 
Status
Not open for further replies.
Back
Top Bottom