• Resolved sanchy.com

    (@sanchycom)


    Hello everyone, I was adding a simple contact form on my wordpress’ beta site https://www.imagina.com.uy/london/contact-international-house-montevideo/

    the ‘action’ is $_SERVER[‘PHP_SELF’] and some code runs according to the information recived after clicking the send button.

    as I said, a simple contact form.

    Thing is, when I submit the form, wordpress isn’t recognizing the permalink and it’s giving me a not found page ??

    any help would be greatly appreciated

    just in case u’d like to see the code

    <form action="<?php $_SERVER['PHP_SELF']; ?>" method="post" style="margin-top:15px; float:left;">
                                	<div class="block"><label>Your e-mail:</label><input type="text" name="email" value="[email protected]" /></div>
                                    <div class="block"><label>Your name:</label><input type="text" name="name" value="Santiago Pardo" /></div>
                                    <div class="block"><label style="width:auto;">The message:</label></div>
                                    <div class="block"><textarea name="message">Hola que tal queria recibir informacion de los cursos</textarea></div>
                                    <div class="block"><input type="submit" value="" name="submit" /></div>
                                </form>
                                <?php
    								if(isset($_POST['submit'])){
    									if (!empty($_POST['name'])) {
    
    										if (!empty($_POST['email'])) {								
    
    											$from = $_POST['name'] . " - " . $_POST['email'] ;
    											$mensaje = $_POST['message'];
    											$asunto = "Contacto desde el Sitio web";
    											$done = "done";
    											mail("[email protected]", "{$asunto}", "{$mensaje}", "{$from}");
    											echo('<div class="popupWrapper"><div class="popup"><p>You message was sent succesfully</p><span class="popupbutt"><span><a href="#" class="hidePU">Back</a></span></span></div></div>');
    
    										} else echo('<div class="popupWrapper"><div class="popup"><p>Remember: if you don′t type your email we<br/>can′t write you back</p><span class="popupbutt"><span><a href="#" class="hidePU">Back</a></span></span></div></div>');
    
    									} else echo('<div class="popupWrapper"><div class="popup"><p>You forgot to write down your name</p><span class="popupbutt"><span><a href="#" class="hidePU">Back</a></span></span></div></div>');
    								}
    							?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter sanchy.com

    (@sanchycom)

    well it seems it had nothing to do with permalinks.

    the problem was one of the $_POST variables was creating some conflict, maybe it was ‘name’, ’email’ or another one. I just changed all of their names and now it’s working fine.

    posting this just in case someone would come across my post ??

    long live wordpress ?? lol wtf x)

    I ran into a similar problem a few times including today. $_POST data doesn’t get sent on form submission but everything looks good code wise. This was after I used much more complicated POST names to ensure zero problems there. Best I can tell problem for me was simply related to lack of name being assigned to input fields.

    Below snippit bits worked for me.

    <form action="<?php the_permalink(); ?>" id="contactForm" method="post">
    				<input type="hidden" name="submitted" value="yes" />
                        <fieldset id="step_1">
    
    				<legend>Step 1</legend>
    				<strong>Please introduce yourself:</strong><br />
    				  <ol class="forms">
                            <li>
    				<label for="contactName">
    					Name-
    				</label>
    				<input type="text" name="contactName" id="contactName" value="<?php echo (isset($_REQUEST['contactName']) ? $_REQUEST['contactName'] : ''); ?>"></input>

    Posting as I’ve run across problem multiple times before and what to throw some help out to myself and others with similar issues.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Contact form not working due to permalinks?’ is closed to new replies.