Hey all.
Below you will see the code of my email form. The first two fields are set that when you click in the field, the text ("name", "email adress") disappears. I'd like to do the same with the textarea, as now "message" remains while clicking in the field.
Then my next question is how to adjust the .phpCode:<script language="JavaScript" type="text/JavaScript"> function clearDefault(el) { if (el.defaultValue==el.value) el.value = "" } </script> <FORM NAME="form1" METHOD="post" ACTION="contact.php"> <input type="hidden" name="action" value="send"> <INPUT TYPE=TEXT NAME="name" VALUE=" name" onFocus="clearDefault(this)" style="border-top:0px; border-left:0px; border-right:0px; border-bottom: 1px dotted #cc6600; width:150px"> <br> <br> <INPUT TYPE=TEXT NAME="email" VALUE=" email adress" onFocus="clearDefault(this)" style="border-top:0px; border-left:0px; border-right:0px; border-bottom: 1px dotted purple; width:150px;"> <br> <br> <TEXTAREA NAME="message" style="border-top:0px; border-left:1px dotted #0066cc; border-right:0px; border-bottom: 1px dotted #0066cc; width:150px; height:63px"> message</TEXTAREA> <br> <br> <INPUT TYPE="image" SRC="images/sendarrow.gif" VALUE="send"> <img src="images/clear.gif" onclick="document.getElementById('form1').reset();" style="cursor:pointer"/> </FORM>
Code:<?php if ($_POST["action"] == "send"){ if ($_POST[name] != " name" and $_POST[name] != "" and $_POST[email] != " e-mail adress" and $_POST[email] != "" and $_POST[message] != "") { mail ("info@site.com", "via site", " Name: ".$_POST['name']." E-mail: ".$_POST['email']." Message: ".$_POST['message']." ", "From: ".$_POST['name']." <".$_POST['email'].">"); $subject = "your message to xx"; $msg = " This is an automatically sent email. Please do not reply. Dear $_POST[name], Thanks for your message to xx. She will get back to you as soon as possible. This was your message: $_POST[message] "; mail($_POST[email], $subject, $msg); echo 'Thanks ! Your message has been sent, and you will receive a confirmation mail. <br><br> We will get back to you as soon as we can.<br> <br><br>'; } else{ echo '<font color="#FF0000">Please fill in all data!</font><br><br>Your name, email adress and message are mandatory fields.<br><br><a href="contact.html"><font color="#FF0000">[again please]</font></a><br> <br>'; } } ?>



Reply With Quote


Bookmarks