1. This website uses cookies. By continuing to use this website you are giving consent to cookies being used.
    For information on cookies and how you can disable them visit our Cookie Usage page.
    Dismiss Notice

contact.php issue with form please help

Discussion in 'Web Design' started by Jim info, Oct 9, 2014.

  1. Jim info

    Jim info New Member

    Hi guys, am having problems with php and a form within css.

    Within my contacts page i have the following code

    <form id="contacts-form" action="contact1.php">
    <fieldset>
    <div class="field">
    <label>Your Name:</label>
    <input type="text" value=""/>
    </div>
    <div class="field">
    <label>Your E-mail:</label>
    <input type="text" value=""/>
    </div>
    <div class="field">
    <label>Your Website:</label>
    <input type="text" value=""/>
    </div>
    <div class="field">
    <label>Your Message:</label>
    <textarea name="textarea" cols="" rows=""></textarea>
    </div>
    <div class="alignright"><a href="#" onclick="document.getElementById('contacts-form').submit()"><strong>Send Your Message!</strong></a></div>
    </fieldset>
    </form>

    I then have a contact1.php file that looks like this

    <?php
    $name = $_POST ['Your Name:'];
    $website = $_POST ['Your Website'];
    $email = $_POST ['Your E-mail:'];
    $message = $_POST ['Your Message:'];
    if(!$name || !$website || !$email || !$message)
    {
    echo "
    <h2>Feedback</h2>
    <form method='post' action='contact1.php'>
    Name: <br /><input name='Your Name:' type='text' value='$name' /><br /><br />
    Company: <br /><input name='Your Website' type='text' value='$website' /><br /><br />
    EMail: <br /><input name='Your E-mail:' type='text' value='$email' /><br /><br />
    Message:<br />
    <textarea name='Your Message:' cols='55' rows='8'>$message</textarea><br /><br />
    <input type='submit' value='Send' />
    </form>
    <p>All fields are required</p>
    ";
    exit;
    }
    $send_to = 'info@cropredyvillage.info'; // change to your email
    mail($send_to, "Name: $name Company: $company" , $message, "From: $email");
    echo "Thank you for your feedback";
    ?>

    I am not very good at php but once i get the correct code it will make sense. On the contact page if you fill in the details and hit send your message it goes to a new page with the Feed back header and some fields. If i re-enter the information and sit send still nothing happens.

    Please help!