Support » Fixing WordPress » How-to put a contact form on the main index?

  • Resolved isaidicanshout

    (@isaidicanshout)


    http://isaidicanshout.com/isics/

    so here’s what i’m working on so far, everything built from the ground up. ignore the content entries, they are placeholders.

    down in the contact area (bottom right, yellow stripe) is a contact form i built in php from a tutorial. it doesn’t seem to work properly. it’s supposed to require the fields provided and send an email, pretty basic.

    if you submit the form without filling ANYTHING out, it reloads the page with warning type about the missing fields but the form is gone.

    if you submit a complete or partially complete form you get a post not found page.

    i still have not sent myself a real email.

    here’s the code i am using. i am open to starting from scratch or using a plugin, but i have not found a plugin that works from index.php:

    <?php
    
    if(isset($_POST['submit_1'])) {
    
    $name = $_POST['name'];
    $contact = "TEST@TEST.TEST";
    $email = $_POST['email'];
    $subject = $_POST['subject'];
    $message = $_POST['message'];
    $error = "";
    $headers = 'From:'.' '. $email;
    
    if($name=="") $error.="Please enter a name"."";
    if($email=="") $error.="Please enter your e-mail"."";
    if($subject=="") $error.="Please enter a subject"."";
    if($message=="") $error.="Please enter a message"."";
    if($error==""){
        echo "<div class='error'>". "Thanks for your message!" ."</div>";
    }
    else {
        echo "<div class='error'>". $error ."</div>";
    }
    
    }
    
    else
    {
    ?>
    	<h2>&nbsp;</h2>
    	<h2>SEND ME A MESSAGE</h2>
    
    	<h2>&nbsp;</h2>
    	<h4>FOR WORK-RELATED INQUIRIES, OFFERS OF TECHNOLOGY OR STEAK, OR JUST TO SAY HI.</h4>
    
    	<h2>&nbsp;</h2>
    	<form action="" method="post">
    	<table class="contactform">
    	<tr><td><h2><input type="text" style="width: 160px" name="name" value=""/> YOUR NAME</h2></td></tr>
    	<tr><td><h2><input type="text" style="width: 160px" name="email" value=""/> YOUR E-MAIL</h2></td></tr>
    	<tr><td><h2><input type="text" style="width: 160px" name="subject" value=""/> SUBJECT</h2></td></tr>
    	<tr><td><textarea name="message" style="width: 256px; height:160px;" rows="" cols=""></textarea></td></tr>
    	<tr><td><input type="image" src="http://isaidicanshout.com/isics/images/isics_send.gif" value="submit" name="submit_1" /></td></tr>
    	</table>
    	</form>
    <?php
    }
    ?>

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How-to put a contact form on the main index?’ is closed to new replies.