Forms

yvettenoone14

New Member
Messages
2
Reaction score
0
Points
0
Hi struggling to get a feedback form working - unsure of the code for the submit button. Just want feedback to come to my email. Can anyone help :confused:
 

Gouri

Community Paragon
Community Support
Messages
4,565
Reaction score
245
Points
63
***** Moved to programming help section ***************

Hi struggling to get a feedback form working - unsure of the code for the submit button. Just want feedback to come to my email. Can anyone help :confused:

Submit the form to some php file which will send the feedback to your mail. There are many feedback forms available on internet.

Remember to add captcha to feedback form to avoid spam.
 
Last edited:

GtoXic

x10 Support
Messages
636
Reaction score
17
Points
0
<form action="http://yoursite.com/url/to/php/file.php"> <-- that will send it to a PHP file.

Then, in the PHP file:

<?php
if(isset($_POST['submit'])){
//code here
}else{
die("Looks like an error occured :O");
}
?>
 

callumacrae

not alex mac
Community Support
Messages
5,257
Reaction score
97
Points
48
FROZENMAFIA! NO! XD

A - use the
PHP:
 tag
B - forms should have a method (in this example, post)
C - use $_SERVER['REQUEST_METHOD'] instead of isset($_POST..
D - why do you insist on not using spacing :(

[php]<?php

if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
	$email = 'Email sent using feedback form on yoursite.' . "\n\n" . 'Name: ' . $_POST['name']; //etc...
	$youremail = 'email@example.com';
	mail($youremail, 'Feedback (subject)', $email, 'From: ' . $youremail);
}
else
{
?>

<form action="file.php" method="post">
<!-- inputs here -->
</form>

<?php
}

~Callum
 
Last edited:
Top