You will need to edit it for your server, remove some stuff etc...
But this should get you going...


<HTML>
<HEAD>
<TITLE>RC Online Canada - Feedback Form</TITLE>
<link href="../style.html" rel="stylesheet" type="text/css">
</HEAD>

<body>

<center>
<H1>Contact RC Online Canada</H1>
</center>
<p>
<center>
<img src="../images/bpix.gif" height="2" width="80%">
</center>
<p>

<center>

<?php

require("../lib/util.php");

function is_valid_email($email) {
        if(ereg("([[:alnum:]\.\-]+)(\@[[:alnum:]\.\-]+\.+)", $email)) {
                return 1;
        } else {
                return 0;
        }
}

if (isset($_POST['action'])) {

        $sql = new MySQL_class;
        $sql->Create("rconline_ca");

        // Lets get some info on who we have
        $sql->QueryRow("SELECT contact_fname, contact_lname, contact_email FROM 
club_info WHERE TRIM(LOWER(uname)) LIKE TRIM(LOWER('$_SERVER[PHP_AUTH_USER]'))");
        if ($sql->rows == 0) {
                ErrorMsg("$_SERVER[PHP_AUTH_USER] was not found in the database");
                Exit();
        }
        $row=$sql->data;

        if (!(is_valid_email($row[contact_email]))) {
                ErrorMsg("Invalid e-mail address '$row[contact_email]' in database. 
Please update you information before using this service.");
                Exit();
        }

        $frommail = strtolower(trim($row[contact_email]));
        $fromname = "$row[contact_fname] $row[contact_lname]";

        ini_set("sendmail_path", "/usr/lib/sendmail -t -i");
        ini_set("sendmail_from", $frommail);

        $tomail = "[EMAIL PROTECTED]";
        $toname = "Webmaster";

        $message = "$_POST[comment]\n\n";
        $subject = "$_POST[subject]";

        $headers= "MIME-Version: 1.0\r\n";
        $headers.= "From: $fromname <$frommail>\r\n";
        if ($_POST[cc]){
                        $headers.= "Cc: $fromname <$frommail>\r\n";
        }
        $headers.= "Reply-To: $fromname <$frommail>\r\n";
        $headers.= "X-Mailer: R/C Online Canada WebMail v1.B\r\n";
        $headers.= "Content-type: text/plain; charset=iso-8859-1\r\n";
        $headers.= "X-Priority: 1\r\n";
        $headers.= "X-MSMail-Priority: High\r\n";

        if (mail("$toname <$tomail>", $subject, $message, $headers))
        {
                echo "<p><b>Your comments have been sent</b></p>";
                echo "<p>Thank you for your interest in RC Online Canada</p>";
                if ($_POST[cc]){
                        echo "<p>A copy has also been sent to: $fromname 
$frommail</p>\r\n";
                }
        }else{
                echo "Failed to send e-mail.";
                echo "<p>";
                echo "Please contact [EMAIL PROTECTED]";
                echo "<p> <FORM><INPUT TYPE=\"Button\" VALUE=\"Back\" 
onClick=\"history.go(-1)\"></FORM>";
        }


} else {

        echo "<form action=\"$PHP_SELF\" method=\"post\">";
        echo "<input type=\"hidden\" name=\"action\" value=\"1\">";

        echo "<p>";

        echo "<table>";
        echo "<tr><td>";
        echo "Subject: </td><td>";
        echo "<select name=\"subject\">\n";
        echo "  <option>Bug Report</option>\n";
        echo "  <option>General Comment</option>\n";
        echo "  <option selected>New Forum Request</option>\n";
        echo "  <option>Feature Request</option>\n";
        echo "</select>\n";
        echo "</td></tr>\n";

        echo "<tr>";
        echo "<td valign=\"top\">Message:</td>";
        echo "<td><textarea  name=\"comment\" cols=\"60\" 
rows=\"10\"></textarea></td>";
        echo "</tr>";

        echo "<tr><td>";
        echo "Copy to myself: </td><td>";
        echo "<input name=\"cc\" type=\"checkbox\" value=\"1\" checked>\n";
        echo "</td></tr>\n";


        echo "</table>";

        echo "<p>";
        echo "<center>";
        echo "<img src=\"/images/bpix.gif\" height=\"2\" width=\"80%\">";
        echo "</center>";
        echo "<p>";

        echo "<input type=\"submit\" value=\"Submit\">";

        echo "</form>";

}
?>

</center>
</BODY>
</HTML>


*********** REPLY SEPARATOR  ***********

On 30/12/2002 at 1:30 AM -<[ Rene Brehmer ]>- wrote:

>Hi y'all
>
>I'm probably trying to do something ridicolously trivial, but here goes:
>
>I'm building a form for sending mail of my website. The idea is simply
>that people plop in their address, the message, and pick a subject line,
>and then click send.
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to