PDA

View Full Version : How do make a simple Reply\Feedback Box on a Site?



100%
10-16-2004, 03:15 PM
I dont want to use the contact via email method - i would like a small box at the bottom of the Site - where people can write in comments etc

http://img.photobucket.com/albums/v173/sjoko/Reply.gif

I found this type here - http://www.linkboxed.com/contact.php

i would like the written info to be sent elsewhere so i can read it privatly and that it is not displayed on the actual site.
In the above link where does this info get sent to?
I am not a web expert (and yes i am working on my other post)
Thanx

100%
10-16-2004, 03:35 PM
ok i found this - looks simple enough - http://phpformgen.sourceforge.net/phpform/

orcutt989
10-17-2004, 03:04 AM
Alright then.

motherflux
10-17-2004, 04:44 AM
I've seen you asking a lot of html questions lately, mr. 15%, and I wondered if you knew about the site http://www.w3schools.com ?
they have tutorials and hands-on examples of everything from html to basic html to server scripting.

Anyway, what you're talking about is a form...
but you're going to need a way to store the comments. I can be a text file or a database or XML or whatever. And you'll need some scripting to handle the form data.

100%
10-17-2004, 09:17 AM
-yes i just decided to get into learning this stuff -itll take years-once you learn one thing - you discover a whole new problem and so forth
Thanks for the link-good stuff-guess you dont want me coming back asking more questions:P

anyway found a simple script for the Report reply form thing

save this into the html page you want it on

<html>

<head>

<title>Feedback Form</title>

</head>

<body>



<h1> Fill in the form below to send us your comments <h1>



<form method="post" action="feedback.php">

Name: <input name=”name” type=”text” /><br />

Email: <input name="email" type="text" /><br />

Comments:<br />

<textarea name="comments" rows="15" cols="40">

</textarea><br />

<input type="submit" />

</form>



</body>

</html>



and save this as feedback.php in the actual folder


<?php



$msg = "Name:t$namen";

$msg .= "Email:t$emailn";

$msg .= "Comments:t$commentsn";



$recipient = "[email protected]";

$subject = "New Feedback from my site";



$mailheaders = "From:$emailn";

$mailheaders .= "Reply-To:$emailnn";



mail($recipient, $subject, $msg, $mailheaders);

header("Location: http://www.yoursite.com/thankyou.html");

?>

motherflux
10-17-2004, 09:51 AM
I didn't intend to imply that your questions are unwanted or an annoyance...quite the opposite. I, and I'm sure others, enjoy exchanging their knowlege on the subject, and teaching others only helps us learn better.
But it is nice to have a resource to fall back on for many of the simple things when first beginning...then you can save the really perplexing troubles for posting :P

anyway...that script is not going to work on most servers now, as it requires REGISTER_GLOBALS to be on in php.ini...and for security purposes it's been set to 'off' by default in php version 4 and above...
there are two solutions.
the first is not recommended, but you can enable REGISTER_GLOBALS if you're hosting on an Apache server. Just add the following line to a text file, and save it as .htaccess
there is no file name, just the extension .htaccess


php_value register_globals 1

*note: .htaccess files can be used for many, many things..including banning users, setting directories, custom error pages, etc.
There's plenty of information about .htaccess files

or, the better solution would be to modify the script.
this is what you'd want.



<?php

$c_name = $_POST['name'];
$c_email = $_POST['email'];
$c_comments = $_POST['comments']

$recipient = "[email protected]";

$subject = "New Feedback from my site";

$mailheaders = "From:$email";

$mailheaders .= "Reply-To:$email";

mail($recipient, $subject, $msg, $mailheaders);

header("Location: http://www.yoursite.com/thankyou.html");

?>

or something of the like.
as you see, the main change is that $_POST['fieldname'] is used to harvest the data from the form.
with register_globals on, the data is made into fieldname variables automatically...which is not really a good idea, as someone could simply create a form, point it to your script, and insert who knows what type of data .

100%
10-17-2004, 10:00 AM
Brilliant - id probably walk into the glitch as soon as id implemented it
one more question though
in the actual "reply box" on the screen do users "HAVE to" put in their email or else it dont work?
id prefer to only have only the reply box (and not the name and email part) so users simply put what ever they want in it and if they want to put in email etc?
id prefer it looking like this

<html>

<head>

<title>Feedback Form</title>

</head>

<body>


<form method="post" action="feedback.php">


Comments:<br />

<textarea name="comments" rows="15" cols="40">

</textarea><br />

<input type="submit" />

</form>

hope this is perplexing enough for you:P


Edit:
I gues then i should change the your php to....?
<?php

$c_name = $_POST['name'];
$c_email = $_POST['email'];
$c_comments = $_POST['comments']

$recipient = "[email protected]";

$subject = "New Feedback from my site";

$mailheaders = "From:$email"; -DELETE THIS???????

$mailheaders .= "Reply-To:$email"; - AND DELETE THIS????????????

mail($recipient, $subject, $msg, $mailheaders);

header("Location: http://www.yoursite.com/thankyou.html");

?>

Forget it ill work it out - thanx anyway;)

motherflux
10-17-2004, 10:17 AM
exactly. with a form that contains only your comment field you could remove all teh variables except for your email address, the actual comment, and..anyway, it would look like this.


<?php

$c_comments = $_POST['comments']

$recipient = "[email protected]";

$subject = "New Feedback from my site";

mail($recipient, $subject, $c_comments);

header("Location: http://www.yoursite.com/thankyou.html");

?>

nice & simple script :D

100%
10-17-2004, 10:19 AM
ZEN script - very nice - cheers