Forum Moderators: mack

Message Too Old, No Replies

Processing reply forms

Which languages/scripts?

         

picophd

12:27 am on Nov 18, 2004 (gmt 0)

10+ Year Member



Greetings,
My humble knowledge in coding only covers XHTML and CSS, so far, and very minimal JavaScript and PHP.

I want to be able to edit and write the code that processes my reply form on my website. Like for instance, instead of putting my email address, I want to put a simple reply form for people to send me messages through. Or even have multiple choice questions for people to answer, then their answers would be processed by the form and sent to me.

I've heard of CGI and PERL. I want to know is processing a form possible only using PHP, for instance? Since I'm already studying it? What are my best options, according to the information I just gave, to be able to code the processing of my web forms?

Thanks for anyone taking the time to help.

coopster

12:35 am on Nov 18, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You could use any server-side scripting software/programs/technology you'd like. I program in many different compiled and scripted languages and can tell you that my personal favorite is PHP, especially for web-based programming and form processing. If I need to go further, I'll use whatever tools necessary, but PHP fits the bill most if not all of the time.

What are your concerns?

picophd

12:45 pm on Nov 18, 2004 (gmt 0)

10+ Year Member



Thank you very much for answering and for the relieving news. :)

My concerns are:

1. the difficulty of learning to process the form or the learning curve (even though I already know that PHP is not hard to learn at all, so it was a relief that you told me PHP alone suffices for this job, but it's just that I don't have that much time);

2. how much time or attention I will need from the website host's administrator, as my host is not very powerful and without a fancy graphical control panel and so, much of the stuff has to be done manually especially by the administrator himself, who is rarely available (!);

3. and finally the format in which I will receive the visitors' answers, especially the multiple-choice answers and numerical data and stuff. I'd like to receive this data in a presentable, easily readable and storeable format. I remember 4 or 5 years ago, when I first tried to process a reply form using the cgi-bin, something had to be done so you can even begin to read the answers.

Stores

12:07 am on Nov 27, 2004 (gmt 0)

10+ Year Member



1. Search around for form handlers. You'll be able to find something you can modify with minimal work (once you know what the code means)

2. You shouldn't need much from the admin at all. As long as your host is reliable...that's all that really matters. I would looks for a host that is more readily available...but I'm sure you have a good reason for using this particular host...so as long as it supports PHP you're all set.

3. You can receive it however you want. You will have to program how you want it to send you the data. You can keep it simple and have it just give you the input name and the value...or you can get as complex with it as you want...it all depends on how much time you want to spend programming it.

picophd

7:23 am on Nov 27, 2004 (gmt 0)

10+ Year Member



Thank you very much, Stores.

I just want the feedback to look organized, maybe in a table, when I receive it. Then, maybe styling the table can happen locally in the same computer where the table is viewed. I guess I gotta dive deeper in PHP for that. :)

Stores

5:17 pm on Nov 27, 2004 (gmt 0)

10+ Year Member



You program how you want the results delivered to you...so if you put in the body of the e-mail, a table, and then populate some fields...you will have the desired results.

picophd

5:33 pm on Nov 27, 2004 (gmt 0)

10+ Year Member



Ok, great, I see what you mean. Thanks. :)

benevolent001

5:52 pm on Nov 27, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



if u just want simple mailer which will send the processed data to your email then u can use this

u have to just place this file in the folder where the page is and that it

<?PHP
$to = "email@yourwebsite.com where it is to be send";
$subject = "New Application";
$headers = "From my website";
$forward = 1;
$location = "its the address of pag where u shd go after submitting thanks.htm";

$date = date ("l, F jS, Y");
$time = date ("h:i A");

$msg = "Below is the result of your feedback form. It was submitted on $date at $time.\n\n";

if ($_SERVER['REQUEST_METHOD'] == "POST") {
foreach ($_POST as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "\n";
}
}
else {
foreach ($_GET as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "\n";
}
}

mail($to, $subject, $msg, $headers);
if ($forward == 1) {
header ("Location:$location");
}
else {
echo "Thanks! . We will get back to you as soon as possible.";
}

?>

picophd

6:04 pm on Nov 27, 2004 (gmt 0)

10+ Year Member



Thank you very much, benevolent001.

But how would this code recognize the SMTP of the server that hosts my website? Doesn't it need the SMTP to be able to send those results?

benevolent001

8:10 pm on Nov 27, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



no you dont need to do anything
just place this code in file named say Form.php and place it in the folder where you place your pages

make the form and configure submit button so that this php file shoould handle processing.

for using this u must have support for php on your server,nothing else rest is just 2 minutes job