Support » Fixing WordPress » Submit form clashing with search

  • Resolved CHEWX

    (@chewx)


    My form is clashing with my search.

    For example if you type in just the title and nothing else, not even spam stopper and submit, it tries to search the site.

    My code:

    <?php
        $name = $_POST['name'];
        $www = $_POST['www'];
        $email = $_POST['email'];
        $twitter = $_POST['twitter'];
        $tags = $_POST['tags'];
        $cats = $_POST['cats'];
        $message = $_POST['message'];
        $from = 'From: Admire-The-Web';
        $to = 'submit@admiretheweb.com';
        $subject = 'Submission';
        $human = $_POST['human'];
    
        $body = "Submission: $www\n Submitted by: $email\n Name of site: $name\n Twitter: $twitter\n Tags: $tags\n Category: $cats\n Additional Information:\n $message";
    
    	if ($_POST['submit']) {
    		if ($www != '' && $email != '') {
    			if ($human == '4') {
    				if (mail ($to, $subject, $body, $from)) {
    				echo '<p style="margin-bottom:20px;">Thank-You for your submission</p>';
    			} else {
    				echo '<p style="margin-bottom:20px;">Something went wrong, go back and try again!</p>';
    			}
    		} else if ($_POST['submit'] && $human != '4') {
    			echo '<p style="margin-bottom:20px;">You answered the anti-spam question incorrectly!</p>';
    		}
    		} else {
    			echo '<p style="margin-bottom:20px;">You need to fill in all required fields for your submission !</p>';
    		}
    	}
    ?>
    
    <div id="submit-form">
    
    <div class="submit-form-submit">
    <form method="POST" action="">
    
        <label>Title (optional)</label>
        <input name="name" type="name" class="drop-shadow" placeholder="The title of the site">
    
        <label>WWW (required)</label>
        <input name="www" type="name" class="drop-shadow" placeholder="www.example.com">
    
        <label>Email (required)</label>
        <input name="email" type="email" class="drop-shadow" placeholder="name@example.com">
    
        <label>Twitter (optional)</label>
        <input name="twitter" type="name" class="drop-shadow" placeholder="@example">
    
        <label>Tags (optional)</label>
        <input name="tags" type="name" class="drop-shadow" placeholder="tag, tag, tag, tag..">
    
        <label>Category (optional)</label>
        <input name="cats" type="name" class="drop-shadow" placeholder="category..">
    
        <label>Additional Information (optional)</label>
        <textarea name="message" class="drop-shadow"  placeholder="I love your work, web inspiration at its best.."></textarea>
    
        <label>*What is 2+2? (Anti-spam)</label>
        <input name="human" class="drop-shadow" placeholder="5">
    
        <input id="submit"  name="submit" type="submit" value="Submit">
    
    </form>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Submit form clashing with search’ is closed to new replies.