HI.
I have a website written using php and css. On the left hand side is my menu, and all the content loads in to a div called "content" using ajax. (no reload).
However i have a feedback form that loads into a div on another layer. That seems to work fine. The probelem is when i try to send it using php. It reloads the index page, and doesn;t send the email. if i load the contact form directly, then it works fine. i really dont know what i'm doing wrong. I have spent the last 4 days working on this, can i have completely run out of ideas.
Code:<? if(isset($_POST['send'])) //check if send was clicked { //form processor $to = $_POST['to']; $email = $_POST['email']; $subject = $_POST['subject']; $phone = $_POST['phone']; $name = $_POST['name']; $message = $_POST['message']; //YOU NEED TO DECLARE FORM VAIRBALES for SECURITY!! $sendmail = mail($to, $subject, $phone, $message, $name); //mail function - mail(to, subject, message); if($sendmail == true) // checks if mail function worked { echo"it worked!"; } else { echo "Error sending message"; } } else // if form was not processed { ?> <form id="form2" method="post" action="" target="_self"> <h3><span>Contact Us</span></h3> <fieldset><legend>Contact form</legend> <p class="first"> <label for="name">Name</label> <input type="text" name="name" id="name" size="30" /> </p> <p> <label for="email">Email</label> <input type="text" name="email" id="email" size="30" /> </p> <p> <label for="web">Phone No.</label> <input type="text" name="phone" id="phone" size="30" /> </p> <p> <label for="message">Message</label> <textarea name="message" id="message" cols="30" rows="10"></textarea> </p> <input type="hidden" name="subject" value="mentoring"> <input type="hidden" name="to" value="ryan.afox@yahoo.com"> <p class="submit"><button type="submit" name="send" value="send">Send</button></p> </fieldset> </form> <? } ?>
Thanks in advance.



Reply With Quote

Bookmarks