Contact Form Help

  • Boke
  • Student
  • Student
  • Boke
  • Posts: 88
  • Loc: Hiroshima, Japan

Post 3+ Months Ago

I can seem to make this work. This is my contact page's code:

Code: [ Select ]
                            <form id="form2" action="contact.php" method="get" enctype="multipart/form-data">
                             <div>
                                    <div class="form"><input type="text" value="name:" /></div>
                                    <div class="form"><input type="text" value="E-mail:" /></div>
                                    <div><textarea name="textarea" cols="20" rows="20">Message:</textarea></div>
                                    <div class="alignright">
                                        <a class="link1" href="#" onclick="document.getElementById('form2').reset()">reset</a>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a class="link1" href="#" onclick="document.getElementById('form2').submit()">submit</a>
                                    </div>
                                </div>
                            </form>
                        </div>
  1.                             <form id="form2" action="contact.php" method="get" enctype="multipart/form-data">
  2.                              <div>
  3.                                     <div class="form"><input type="text" value="name:" /></div>
  4.                                     <div class="form"><input type="text" value="E-mail:" /></div>
  5.                                     <div><textarea name="textarea" cols="20" rows="20">Message:</textarea></div>
  6.                                     <div class="alignright">
  7.                                         <a class="link1" href="#" onclick="document.getElementById('form2').reset()">reset</a>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a class="link1" href="#" onclick="document.getElementById('form2').submit()">submit</a>
  8.                                     </div>
  9.                                 </div>
  10.                             </form>
  11.                         </div>


and this is my contact.php:
Code: [ Select ]
<?
$subject="from ".$_GET['name:'];
$headers= "From: ".$_GET['E-mail:']."\n";
$headers.='Content-type: text/html; charset=iso-8859-1';
mail("no external links", $subject, "
<html>
<head>
<title>Contact letter</title>
</head>
<body>

<br>
 ".$_GET['Message']."
</body>
</html>" , $headers);
echo ("Your message was successfully sent!");
?>
<script>
    resizeTo(300, 300)
    //window.close()
</script>
  1. <?
  2. $subject="from ".$_GET['name:'];
  3. $headers= "From: ".$_GET['E-mail:']."\n";
  4. $headers.='Content-type: text/html; charset=iso-8859-1';
  5. mail("no external links", $subject, "
  6. <html>
  7. <head>
  8. <title>Contact letter</title>
  9. </head>
  10. <body>
  11. <br>
  12.  ".$_GET['Message']."
  13. </body>
  14. </html>" , $headers);
  15. echo ("Your message was successfully sent!");
  16. ?>
  17. <script>
  18.     resizeTo(300, 300)
  19.     //window.close()
  20. </script>


I'm having trouble with the onclick and reset parts, I tried to follow a couple of tutorials but I'm just not getting anywhere.
  • BIOSTALL
  • Graduate
  • Graduate
  • User avatar
  • Posts: 125
  • Loc: UK

Post 3+ Months Ago

Hmmm... works for me. You haven't got two forms with the ID of 'form2' on your page have you by any chance?

Also, try adding 'name="form2"' to the <form> tag and then using 'document.form2.reset()' and 'document.form2.submit()' on your links.

Let me know how you get on,

BIOSTALL

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 14 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.