Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am trying to make my own contact form without the aid of a plugin.

Shouldn't be that difficult so I created this template:

<?php
/*
Template Name: Contact Form
*/
?>

<?php 
//If the form is submitted
if(isset($_POST['submitted'])) {
 //If there is no error, send the email
 wp_mail($_POST['email'], "Thank You", $_POST['digits']);
 if(!isset($hasError)) {

 }
} ?>

<?php get_header(); ?>

<?php 
//If the email was sent, show a thank you message
//Otherwise show form
if(isset($emailSent) && $emailSent == true) {
?>

<div class="thanks">
  <h1>Thanks, <?=$name;?></h1>
  <p>Your email was successfully sent. I will be in touch soon.</p>
 </div>

<?php } else { ?>
<?php if (have_posts()) : ?>

  <?php while (have_posts()) : the_post(); ?>
   <?php the_content(); ?>

   <?php if(isset($hasError) || isset($captchaError)) { ?>
    <p class="error">
     There was an error submitting the form.
    <p>
   <?php } ?>

   <form action="<?php the_permalink(); ?>" id="contactForm" method="post">
    <input type="hidden" name="submitted" value="1"/>
        <label>Gift Certificate recepient's E-Mail address:</label><input type="text" name="email"/>
        <label>PayPal receipt's number 4 Last Digits:</label><input type="text" name="digits"/>
        <input type="submit" value="SEND"/>
   </form>

  <?php endwhile; ?>
 <?php endif; ?>
<?php } ?>

<?php get_footer(); ?>

I made page with it the above template but the problem is that everything seems to look fine, except that I cannot click on any of the form elements. It seems as if they are locked or something. Any idea why this might be happening?

Thanks ;)

share|improve this question
Do you have a live example? The code looks fine from what I can see, and if I paste your form into jsfiddle I have no issues. So I suspect the actual rendering of the markup or css is causing a problem. – Jared Cobb Feb 21 '12 at 20:40
Yes it was theme's CSS. I had to wrap my code inside div.entry and then it worked. I didn't know it is possible with CSS to disable certain area of your page if not wrapped inside desired container?? Thanks – daniel trifunovic Feb 22 '12 at 5:22
@danieltrifunovic if you have resolved your question on your own then please post your solution as an answer so to better aid others that visit this site. – Brady Feb 22 '12 at 9:48

closed as too localized by toscho Oct 14 '12 at 6:12

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, see the FAQ.

1 Answer

Code was not properly wrapped inside theme recognised container so I had to enclose within specifically named div container.

Another good reason to avoid complicated themes as they can waste you time and potential to be creative ;)

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.