Form writing: I have no idea what's going on

Hello all!

So I understand the HTML end of Form writing (You know, <form>) That much makes sense and it’s all relatively streamlined.

But the whole bit regarding getting the form processed through a CGI script (Perl?) is very confusing to me.

So some questions:
• What happens to a submitted form that is not run through a script, yet, is sent to an “mailto:” address? Is it mish-mosh or can it be read? (To date, I cannot get the form I’m playing with to send to the listed email.)

• Must a processing form be written? Or are there services typically offered through web hosts?

I’m utilizing justhost.com which apparently has the resources, but how it works, I’m baffled.

Very open question, but any light shed on this issue is welcome. There are so many tutorials that only lightly mention the relationship and it’s frustrating because no one definitively has said if a form can exist without a processor, and if so, what are the benefits/disadvantages.

[FONT=Verdana][SIZE=2]Basically you would have to write some server-side form mail script which relates to the variable names in the HTML form or download a prepared form-mail and edit the variables for example the NAME attribute.

HTML is purely static thus you’d reference the PHP or Perl script name in the HTML “action” attribute for a crude over simplified version:

[/SIZE][/FONT]

<form method="post" action="sendmail.php">
Email: <input name="email" type="text" />
 <br />
Message:
<textarea name="message" rows="15" cols="40"></textarea>
 <br />
<input type="submit" />
</form>


<?php  $email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
mail( "yourname@example.com", "Feedback Form Results",    $message, "From: $email" );
header( "Location: http://www.example.com/thankyou.htm" );?>

As you can see in the PHP file called ‘sendmail.php’ above it uses the HTML form values; name=“message” and name=“email”.

Let’s see if I can explain this simply; I’ll kill most of the details.

Just about every host out there (Excluding free ones) comes with an email server, and a CGI, Perl, PHP, etc interpreter. A script (They are all called a [Name] script, so script is the shorter way) utilizes the mail server and sends the e-mail.

So basically, you put the place of the script in the action=“” attribute, and then the info in the form is sent to the magic interpreter, they do some abbra ka dabra and wahlah! Somebody get’s an e-mail. :wink:

And to answer your questions, some hosts have one you can use, others don’t. If you ever need a free one, NMS FormMail is a good free one.

What do you mean? Would you please expound a little?

Hotness!

Now, generally (because I know you can’t answer for all scripts) how would I go about telling the Perl script to email the translated message to an email I provide?

Or is that handled internally?

most ISP’s have some form of sendmail with some generic working sample. (At least the one’s I’ve dealt with.)

xhtml showed you a good example of the basics. What you need to do in addition to that is add your form variables so they display in the mail message.


$name= $_REQUEST['name'] ; // where 'name' is the name or id of your field.
mail( "yourname@example.com", "Feedback Form Results",    $message, "From: $email", $name );

I may not have the syntax exactly correct off the top of my head but you get the idea. :slight_smile: