Hi guys, I need help in getting a script for my Contact Us page and the testimonials page. I quite bad in php and asp. Is there any simple code or tutorials in the webs that I follow thru the steps? I had been looking around the web for quite sometimes but to no avail. TKs.
I've got a good script, lemme get the php file for you. You can see it here: http://www.moddedmustangs.com/contact-us/ edit - here is the code. replace the stuff I changed for your email address, message, etc. and the color style for the boxes (I run a dark theme - just remove the style="000000" stuff). All you gotta do is call it with a php includes, or put this in your php file. <?php /** * Change the email address to your own. * * $empty_fields_message and $thankyou_message can be changed * if you wish. */ // Change to your own email address $your_email = "Insert Email Address"; // This is what is displayed in the email subject line // Change it if you want $subject = "Contacting Insert Site Name"; // This is displayed if all the fields are not filled in $empty_fields_message = "<p>Please go back and complete all the fields in the form.</p>"; // This is displayed when the email has been sent $thankyou_message = "<p>Insert your Thank you Message</p>"; // You do not need to edit below this line $name = stripslashes($_POST['txtName']); $email = stripslashes($_POST['txtEmail']); $message = stripslashes($_POST['txtMessage']); if (!isset($_POST['txtName'])) { ?> <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>"> <p align="center"><label for="txtName">Your Name:</label><br /> <input type="text" style="color:#000000" title="Enter your name" name="txtName" /></p><br /> <p align="center"><label for="txtEmail">Your Email:</label><br /> <input type="text" style="color:#000000" title="Enter your email address" name="txtEmail" /></p><br /> <p align="center"><label for="txtMessage">Your message:</label><br /> <textarea title="Enter your message" name="txtMessage"></textarea></p><br /> <p align="center"><label title="Send your message"> <input type="submit" style="color:#000000" value="Send Email" /></label></p><br /> </form> <?php } elseif (empty($name) || empty($email) || empty($message)) { echo $empty_fields_message; } else { // Stop the form being used from an external URL // Get the referring URL $referer = $_SERVER['HTTP_REFERER']; // Get the URL of this page $this_url = "http://".$_SERVER['HTTP_HOST'].$_SERVER["REQUEST_URI"]; // If the referring URL and the URL of this page don't match then // display a message and don't send the email. if ($referer != $this_url) { echo "You do not have permission to use this script from another URL, nice hacking attempt moron."; exit; } // The URLs matched so send the email mail($your_email, $subject, $message, "From: $name <$email>"); // Display the thankyou message echo $thankyou_message; } ?> Code (markup):
I just edited my post above and put it in. If you need any help getting it going just ask. It's simple though, I just put it in another file and called it with an includes.
mdvaldosta, Do I have to make 2 separate asp file for 'contact us' and 'testimonials' page? Do I have to combine it to my HTML page ?
Below is the code.Extract from my website. Do I combine the PHP code that you shown me with my table below? <form action="" method="post" name="form" id="form"> <table width="90%" border="0" cellspacing="2" cellpadding="4"> <tr> <td width="10%" align="right" valign="top">Name:</td> <td colspan="2" valign="top"><input name="name" type="text" id="name" size="30"> </td> </tr> <tr> <td width="10%" align="right" valign="top">Email:</td> <td colspan="2" valign="top"><input name="email" type="text" id="email" size="30"> </td> </tr> <tr> <td width="10%" align="right" valign="top">Subject:</td> <td colspan="2" valign="top"><input name="subject" type="text" id="subject" size="30"> </td> </tr> <tr> <td valign="top" align="right" width="10%">Message:</td> <td colspan="2" valign="top"><textarea name="message" cols="30" rows="5" id="message"></textarea> </td> </tr> <tr> <td width="10%" align="right"> </td> <td colspan="2"><input type="submit" name="Submit" value="Send"> </td> </tr> </table> </form>
hey I can provide you a nice Contact Us forum in that form when some1 will send you a msg the sender will receive a thank you email & lot more in that form, if u need it plz send me PM. if u want t creat your own & simple form plz log in to this site for FREE and set all fields according to ur own choice! http: // www . hotwebtools . com / form_gen (plz remove space befre visiting it as i am new & not allowed Live links enjoy Mr Rock