iGuest 3 Report post Posted December 18, 2004 ok im trying to make a form for my website but its not really working.This is my script so far. <form action="mailto:gregtreich@gmail.com" method="post"> <p> <input name="textfield" type="text"> Your Name Here</p> <p> <input name="textfield" type="text"> Your E-mail Here</p> <p> <input name="textfield" type="text"> Subject</p> <p> <textarea name="textarea"></textarea> Comments Or Questions</p> <p> <input type="submit" name="Submit" value="Submit"> <input type="reset" name="Reset" value="Reset"></p> </form>if someone could help me thanks[/code] Share this post Link to post Share on other sites
iGuest 3 Report post Posted December 18, 2004 i would recommend using either a cgi or php mail script to process the form. i can send you a very good, well commented one written in perl if you would like. its free for non-commercial use Share this post Link to post Share on other sites
iGuest 3 Report post Posted December 19, 2004 ok but i have no knolage of perl so i might need some help installing it. Share this post Link to post Share on other sites
iGuest 3 Report post Posted December 19, 2004 well... i have a php one, u want it? Share this post Link to post Share on other sites
iGuest 3 Report post Posted December 19, 2004 yah ok thanks Share this post Link to post Share on other sites
iGuest 3 Report post Posted December 19, 2004 [i made i copletely new script for you and i didn't test it , so if you have problems tell me so i can fix it] Ok, this is my script so you can do whatever with it. What it does: It first checks that you filled in all the fields and that your emails match so you can answer. Once you fill in all the fields and hit send, it tells you it was sent, your name, your email, to who it was sent, what was the subject, and what the mesage was. Or if there was a problem it gives you an error. !!You have to leave the file names the same!! Your gonna have to change the folowing in the file(s): In sendform.php you have to set the variable $to to your email (it's replaced by a load of slashes) --------------------form.php-------------------- <html><body><form name="contact" method="post" action="sendform.php"><table align="center" cellpadding="4" cellspacing="0"> <tr> <td>Your Name:</td> <td><input type="text" name="name"></td> </tr><tr> <td>Email:</td> <td><input type="text" name="email"></td> </tr> <tr> <td>Confirm Email:</td> <td><input type="text" name="conf_email"></td> </tr> <tr> <td>Subject:</td> <td><input type="text" name="sub"></td> </tr><tr> <td>Message:</td> <td><textarea name="msg" cols="20" rows="6"></textarea></td> </tr> <tr> <td colspan="2" align="right"><input type="submit" name="submit" value="Submit"></td> </tr></table></form></body></html> --------------------sendform.php-------------------- <?phpif($name == "") { echo "Please fill out your name.<br>";}elseif($email == "") { echo "Please fill out your email address.<br>";}elseif($email == $conf_email) { echo "Your emails do not match.<br>";}elseif($sub == "") { echo "Please fill out a subject.<br>";}elseif($msg == "") { echo "Please fill out a message.<br>";}else {$to = "///////////////////////////////////////////////////////////////////////////////";$subject = "$sub<$name, $email>"; @extract($_POST); mail($to,$subject,$msg,"From: $name <$email>");{echo "<center><h1>Email Sent</h1></center><br>Your name is: <b>$name</b><br>Your email is: <b>$email</b><br>An e-mail was sent to: <b>$to</b><br>With the subject: <b>$subject</b><br>And the mesage was: <b>$msg</b>";} else {echo "<center><h1>Error!</h1></center><br>There was a problem sending the mail. Check your code and make sure that the e-mail address $to is valid";}?> Ok, to use it in your site just use php include, you know what that is right? 8) ENJOY! Share this post Link to post Share on other sites
iGuest 3 Report post Posted December 20, 2004 Ok i got it all inplace but when i try it out i get this "; } elseif($email == "") { echo "Please fill out your email address."; } elseif($email == $conf_email) { echo "Your emails do not match."; } elseif($sub == "") { echo "Please fill out a subject."; } elseif($msg == "") { echo "Please fill out a message."; } else { $to = "gregtreich@gmail.com"; $subject = "$sub<$name, $email>"; @extract($_POST); mail($to,$subject,$msg,"From: $name <$email>"); { echo "Email SentYour name is: $nameYour email is: $emailAn e-mail was sent to: $toWith the subject: $subjectAnd the mesage was: $msg"; } else { echo "Error!There was a problem sending the mail. Check your code and make sure that the e-mail address $to is valid"; } ?> i changed the line with the ////'s to $to = "gregtreich@gmail.com";please help.Thanks Share this post Link to post Share on other sites
iGuest 3 Report post Posted December 20, 2004 well i made a form script if your interested its in 2 seperate pages... It has been tested My from is made with 2 seperate pages...just the way i code First make a form... (this subjectis in a dropdown list...as if you couldnt tell ) name this page contact.php <form action="contact2.php" method=POST>First name:<br> <input type="text" name="firstname" size="30" maxlength="30" /><br /> Last name:<br> <input type="text" name="lastname" size="30" maxlength="30" /><br />E-mail address:<br> <input type="text" name="email" size="30" maxlength="30" /><br />Subject:<br><!-- add as many <option value="" name="">NAME</options> as you want --><select name="subject"> <option vlaue="Complaint" name="complaint" selected="selected">Complaint</option> <option value="Question" name="question">Question</option> <option value="Suggestion" name="suggestion">Suggestion</option></select><br />What is it?:<br><textarea COLS="40" ROWS="5" name="comment"></textarea> <p><input name="submit" type="submit" value="Submit"><input name="reset" type="reset" value="Reset"></form> now make another page and name it contact2.php and add this to it <?php//get the posted information$first = $_POST['firstname'];$last = $_POST['lastname'];$email = $_POST['email'];$subject = $_POST['subject'];$comment = $_POST['comment'];//get rid of the extra spaces$first = trim($first);$last = trim($last);$email = trim($email);$subject = trim($subject);$comment = trim($comment);//get rid of the access /'s that php automatically adds$first = stripslashes($first);$last = stripslashes($last);$email = stripslashes($email);$subject = stripslashes($subject);$comment = stripslashes($comment);//make the form again so you dont have to post it every time$form = "<form action="contact2.php" method="POST">First name:<br> <input type="text" name="firstname" size="30" maxlength="30" /><br /> Last name:<br> <input type="text" name="lastname" size="30" maxlength="30" /><br />E-mail address:<br> <input type="text" name="email" size="30" maxlength="30" /><br />Subject:<br>//if you added any extra <option value= name=>NAME</options> add them here also<select name="subject"> <option vlaue="Complaint" name="complaint" selected="selected">Complaint</option> <option value="Question" name="question">Question</option> <option value="Suggestion" name="suggestion">Suggestion</option></select><br />What is it?:<br><textarea COLS="40" ROWS="5" name="comment"></textarea> <p><input name="submit" type="submit" value="Submit"><input name="reset" type="reset" value="Reset"></form>";//if any of them are empty display a message and the form againif(empty($first)) {echo "Please Type in your first name";echo "$form";}elseif(empty($last)) {echo "Please Type in your last name";echo "$form";}elseif(empty($email)) {echo "Please Type in your email";echo "$form";}elseif(empty($comment)) {echo "Please Type in your problem or question";echo "$form";}else{//if all are filled in then mail the information and display a messagemail("[color=red]YOUR EMAIL[/color]", "contact - $subject", "Name: $firstname $lastnamenEmail: $emailnSubject: $subjectnComments: $comment", "From: $email");echo "Thank you! We will get back to you shortly.";}?> I tried to comment it well...but if you still need help just post. Share this post Link to post Share on other sites
iGuest 3 Report post Posted December 20, 2004 I propably frogot to put the extract for post on top...try this: (i'm sorry i didn't test it) <?php @extract($_POST);if($name == "") { echo "Please fill out your name.<br>";}elseif($email == "") { echo "Please fill out your email address.<br>";}elseif($email == $conf_email) { echo "Your emails do not match.<br>";}elseif($sub == "") { echo "Please fill out a subject.<br>";}elseif($msg == "") { echo "Please fill out a message.<br>";}else {$to = "gregtreich@gmail.com";$subject = "$sub<$name, $email>"; @extract($_POST); mail($to,$subject,$msg,"From: $name <$email>");{echo "<center><h1>Email Sent</h1></center><br>Your name is: <b>$name</b><br>Your email is: <b>$email</b><br>An e-mail was sent to: <b>$to</b><br>With the subject: <b>$subject</b><br>And the mesage was: <b>$msg</b>";} else {echo "<center><h1>Error!</h1></center><br>There was a problem sending the mail. Check your code and make sure that the e-mail address $to is valid";}?> Share this post Link to post Share on other sites
iGuest 3 Report post Posted December 20, 2004 thanks for your help Share this post Link to post Share on other sites
iGuest 3 Report post Posted December 22, 2004 If you want a simpler way just you phpgenerator which is in Cpanel's script library or there is dynaform, both work well and are user friendly. Share this post Link to post Share on other sites
iGuest 3 Report post Posted January 14, 2005 Im not sure that HTML alone can send e-mail, Guess at least JS needed to do that Share this post Link to post Share on other sites
iGuest 3 Report post Posted February 22, 2005 :mrgreen: Share this post Link to post Share on other sites