October 6, 200916 yr Ok thanks I'll try this tonight. Also I need to change the 'website url' to telephone number, so need to know which parts of the php script need changing accordingly - I'm sure I can figure it out myself eventually though! PHP is on my list of things to learn, but now I'm simply copying the ocde and hope it works
October 6, 200916 yr You won't see PHP when you view source because it's parsed before it reaches the browser - that means that PHP is doing its job I've just had a look at your contact.php and it still says mail_form_v2.php in the form: <form action="mail_form_v2.php" method="post"> This needs changing to: <form action="contact.php" method="post">
October 6, 200916 yr So i don't need a separate php file then, as long as I amend the "form action" part? Cool thanks.
October 6, 200916 yr You seem to have already put the code into contact.php? As long as I have that right, it will work from there
October 12, 200916 yr Sorry to be more of a pain, but I'm finding the emails are going to my junk folder - any idea why this might be? Thanks
October 13, 200916 yr It happens sometimes. I need more details - what mail provider are you using? This is something integrated into the host package I presume? I will try and find out tomight.
October 13, 200916 yr Sorry, I wasn't specific, I meant what's the mail provider of the recipient address; e.g. gmail, yahoo, or through your own domain (which I guess is what you're saying ) I ask because it's easy to whitelist certain incoming mail through some providers. If you're having these mails sent to an account hosted through your domain, is SpamAssassin enabled on the account?
October 13, 200916 yr ah right I see what you mean - I know this is easy enough to do, but for my comeletely computer-illiterate dad this may prove a challenge! Just wondered if there was anything I could do my end to change it?
October 30, 200916 yr Anyone have any ideas here. I'd really appreciate the help! Thanks E Hi there, I had exactly the same problem you had with spam about a year ago and I didnt want to use captcha to stop spam so I came up with the following (Im sure others have done this before) I have never had any spam since (touch wood!) Add the following to your CSS file: .botcatch { visibility:hidden; } Add a text field to your contact form and assign it the class you made <input name="fieldname" type="text" value="" class="botcatch" /> then in your PHP code do the following <?php // If the Send button is pressed if ($_POST['submit']) { // If a bot is attempting to send spam if ($_POST['fieldname'] !="") { //Boot it out of the server die(); } else { //Enter mail code here } } else {} ?> This works for me Let me know what you think. Thanks, Chris
November 11, 200916 yr Yea they will allow php because I am using MySql queries in php files etc? I have with: www.zymic.com (my domain is uuuq.com) Thanks for the fast reply! You could use something like phpmailer and use a SMTP configuration.
November 11, 200916 yr A quick contact form.. took me about 5mins. Just dump in an XHTML strict header, validate it and change a few html elements and you have a XHTML strict form.. don't waste your money on dire scripts Ideally you'd implement a CAPTCHA but i'm not going to spend much more time on it. <?php // If the Send button is pressed $submit = (isset($_POST['submit'])) ? $_POST['submit'] : FALSE; $name = (isset($_POST['name'])) ? $_POST['name'] : FALSE; $email = (isset($_POST['email'])) ? $_POST['email'] : FALSE; $sum1 = (isset($_POST['sum1'])) ? $_POST['sum1'] : FALSE; $sum2 = (isset($_POST['sum2'])) ? $_POST['sum2'] : FALSE; $answer = (isset($_POST['answer'])) ? $_POST['answer'] : FALSE; $errors = array(); $success = FALSE; if ($submit) { if (($sum1+$sum2) == $answer) { // mail here. $success = TRUE; } else { $errors[] = 'Answer incorrect.'; } } // Some randoms $number1 = rand(1,20); $number2 = rand(1,20); ?> <html> <head> <title> My Contact form</title> <style type="text/css"> label { display:block; } </style> </head> <body> <?php if(count($errors) != 0): ?> <ul class="errors"> <?php foreach($errors as $e): ?> <li><?php echo $e; ?></li> <?php endforeach; ?> </ul> <?php endif; ?> <?php if($success): ?> <div class="success">Thanks! We'll get back to you shortly.</div> <?php endif; ?> <form action="" method="post"> <label for="name">Your name: </label> <input type="text" name="name" id="name" value="<?php echo (($name) ? $name : ''); ?>" /><br /> <label for="email">Your email: </label> <input type="text" name="email" id="email" value="<?php echo (($email) ? $email : ''); ?>" /><br /> <p><strong>You're human right?</strong></p> <p>Please answer this question: What is <?php echo $number1; ?> PLUS <?php echo $number2; ?> <input type="text" name="answer" value="" style="width:40px;" /></p> <input type="hidden" name="sum1" value="<?php echo $number1 ?>" /> <input type="hidden" name="sum2" value="<?php echo $number2; ?>" /> <input type="submit" name="submit" value="contact me..." /> </form> </body> </html>
December 5, 200916 yr I might be a bit dozy but when I copied the code into my html page I got this error - "Fatal error: Call to undefined function get_data() in C:\wamp\www\contact-us.php on line 20" Anyone know what I am doing wrong? I have amended the php part of it with my email address and website address so am unsure what to do and would really appreciate some help Thanks
February 23, 201016 yr I've only just started dabbling with script and using it in web pages. I tried a couple of others first but thanks to the advice on here tried this one and got it to work here: http://www.anthonyparker.co.uk/trailriders/booking.html I too would like to know what exactally I need to add to the script to replace : <p>Your mail was successfully sent.</p> with a thank you page of my own creation? cheers, t.c.
March 21, 201016 yr @ tonychang: Replace echo '<p>Your mail was successfully sent.</p>'; with: header('location: filepath of success page');
April 14, 201016 yr RuubikCMS has now a contact form that also works as stand-alone PHP script. It features: XHTML 1.0 Strict No tables Simple CSS styling with 2 included layout options User defined fields in the settings code (selects, text inputs, message and checkboxes) Mark certain fields as required Verification of required fields (server side) Verification for email header & html input injection Validation of email address (server side) Google AdWords Conversions tracking option Optional robot question Various settings for customization The demo is located here and the script can be downloaded from the RuubikCMS forum topic.
Create an account or sign in to comment