My teacher wants me to create a website for the school. However, I'm horrible at making websites, especially form (which he wants me to do). Does anyone know form where the user fills out gets sent to a predefined e-mail?
Thanks a lot,
Edward
-
-
usapatriot Notebook Nobel Laureate
Why would he ask you if you don't know how to do it?
I would say to tell him you cannot because you do not know how.
Or hire a company to do it for you. -
You are going to need to learn about form processing. If you know HTML and CSS, that won't cut it for forms. Do you know any PHP or Perl, or CGI for that matter? I use Perl scripts for my forms.
-
Yes, I know HTML won't cut it and that's why it's causing me so much trouble... To be exact, he want "a form where the user fills out a comment box and send it to a pre-destined e-mail".
I got myself into this because 1) there's bonus marks involved and 2) i want a challenge and thought a simple google search would do the trick. So far, I've found guides for frontpage, but nothing for dreamweaver (the only thing I have right now). -
Here is a very basic php script to process a form.
First you need to create the form to process.
HTML:<html> <body> <form name="frmContact" method="post" action="path/to/mail.php"> <label for="name">Name: </label> <input type="text" name="name" />[br][/br][br][/br] <label for="email">Email: </label> <input type="text" name="email" />[br][/br][br][/br] <label for="comments">Comments: </label> <textarea name="comments" rows="10" cols="40"></textarea> </form> </body> </html>
PHP:<?
function checkOK($field)
{
if (eregi("\r",$field) || eregi("\n",$field)){
die("Invalid Input!");
}
}
//set the variables
$name=$_POST['name'];
checkOK($name);
$email=$_POST['email'];
checkOK($email);
$comments=$_POST['comments'];
checkOK($comments);
//email address you want the form to be sent to
$to="[email protected]";
//the contents of the email message
$message="$name just filled in your comment form. Their said:\n$comments\n\nTheir e-mail address is: $email";
if(mail($to,"Website Comments",$message,"From: $email\n")) {
//Thank them if it went through
echo "Thanks for your comments.";
} else {
//give them an error if it didn't
echo "There was a problem sending the mail. Please check that you filled in the form correctly.";
}
?>Last edited by a moderator: May 7, 2015 -
Thanks a lot!
-
well, i have made one for my school, very easily with php coding. it has most of the functions. the webiste is www.almajdsc.edu.tf - the school is buying for me a premium server this week and will change to .com
School Website
Discussion in 'Windows OS and Software' started by hehe299792458, Feb 1, 2007.