php - HTML form POST not sending values -
i know there has been couple of threads that, have looked through them , can't seem able find answer. have html form php file action , method post. here form:
<div class="col-md-4 col-sm-12"> <div class="contact-form bottom"> <h2>send message</h2> <form id="main-contact-form" name="contact-form" method="post" action='http://creobox.ie/site/sendemail.php'> <div class="form-group"> <input type="text" name="name" class="form-control" required="required" placeholder="name"> </div> <div class="form-group"> <input type="email" name="email" class="form-control" required="required" placeholder="email id"> </div> <div class="form-group"> <textarea name="message" id="message" required="required" class="form-control" rows="8" placeholder="your text here"></textarea> </div> <div class="form-group"> <input type="submit" name="submit" class="btn btn-submit" value="submit"> </div> </form> </div> </div>
please note, tried using action ="sendemail.php" no effect.
then trying data in php file, so:
$name = @trim(stripslashes($_post['name'])); $from = @trim(stripslashes($_post['email'])); $subject = @trim(stripslashes($_post['subject'])); $message = @trim(stripslashes($_post['message']));
the rest of code composing e-mail etc - part works fine.
am missing simple? code looks fine! did echo on $name, $from, $subject , $message , got was
details : <br/>
no errors showing or anything... help!
ok, tried go ajax... modified form
<div class="contact-form bottom"> <h2>send message</h2> <form id="main-contact-form" name="contact-form"> <div class="form-group"> <input type="text" name="name" class="form-control" required="required" placeholder="name"> </div> <div class="form-group"> <input type="email" name="email" class="form-control" required="required" placeholder="email id"> </div> <div class="form-group"> <textarea name="message" id="message" required="required" class="form-control" rows="8" placeholder="your text here"></textarea> </div> <div class="form-group"> <input type="submit" name="submit" class="btn btn-submit" value="submit" href="javascript: void(0);" onclick = "sendmail();"> </div> </form> </div>
and created js function
function sendmail() { var name = document.getelementbyid('name'); var email = document.getelementbyid('email'); var message = document.getelementbyid('message'); $.ajax({ type: 'post', url: 'sendemail.php', data: { 'name' : name, 'email' : email, 'message' : message }, success: function(json) { if (json.status == 's') alert('duplicates removed!'); }, error: function() {} }); }
but doesn't work either... 304 - not modified error cached index page. starting burn brain! using old version of jquery, hence problems?!
Comments
Post a Comment