Easy HTML form creation?

Mar 15, 2003
12,668
103
106
I used to make quick forms using front page but my new host doesn't seem to support front page extensions - any other easy way to make forms that email results to you? thanks!
 

Beau

Lifer
Jun 25, 2001
17,730
0
76
www.beauscott.com
can you run PHP on your new host?

if so, submit your form to the following PHP script:

<?php

if(empty($_REQUEST['to']) die 'Did not specify an address to send the email to.';
if(empty($_REQUEST['email']) die 'Did not give a \'Reply-to\' email address.';

$to = $_REQUEST['to'];
$from = $_REQUEST['email'];
$subject = empty($_REQUEST['subject']) ? 'Mail form submitted from ' . $_SERVER['HTTP_HOST'] : $_REQUEST['subject'];

$headers = "To: <" . $to . ">\r\n";
$headers .= "From: <" . $from . ">\r\n";
$headers .= "Subject: " . $subject . "\r\n";

$body = '';
foreach($_REQUEST as $key => $value)
$body .= $key . " : " . $value . "\n";


mail($to, $subject, $body, $headers);

if(!empty($_REQUEST['renturn_to']))
header('Location: ' . $_REQUEST['return_to']);
else
echo 'Thank you for your request. <a href="#" onclick="history.go(-1)">Click here to return</a>.';

?>

This will send all the form fields back to you from your form. There are 2 form fields that must be submitted, and 2 more that add addition functionality:

Required:

'to' is your email address, or the email address you want the results sent to. Make this a hidden form field.
'email' is the client email address. Make this a visible form field.

Optional:
'subject' provides the subject line of the email. Maybe set this to a topic that the user selects.
'return_to' is the URL that you want the customer to return to after the form is submitted.