Some PHP variables not appearing when contact us form is used -


below php code contact form, website live @ moment , when use form send query using contact form, not information gets through:

in email receive, information comes through $subject , message ($name move in on $move.\r\n\n";). no other data client inputs on website listed in email. have looked @ code , cant seem find wrong.

i appreciate help.

<?php if(!$_post) exit;      $to       = 'mydomain@email.com';      $name     = $_post['txtname'];     $email    = $_post['txtemail'];     $phone    = $_post['txtphone'];     $comp     = $_post['txtcomp'];     $emp      = $_post['txtemp'];     $move     = $_post['txtmove'];     $comment  = $_post['txtmessage'];      if(get_magic_quotes_gpc()) { $comment = stripslashes($comment); }       $subject = 'you\'ve been contacted ' . $name . '.';       $msg  = "you have been contacted $name.\r\n\n";        $msg .= "$comment\r\n\n";      $msg .= "you can contact $name via email, $email.\r\n\n";      $msg  = "you can call $name on $phone.\r\n\n";      $msg  = "$name has $emp employees , company name $comp.\r\n\n";      $msg  = "$name move in on $move.\r\n\n";        $msg .= "-------------------------------------------------------------------------------------------\r\n";       if(@mail($to, $subject, $msg, "from: $email\r\nreturn-path: $email\r\n"))      {          echo "<span class='success-msg'>thanks contacting us, call soon.</span>";      }      else      {          echo "<span class='error-msg'>sorry message not sent, please try again.</span>";      } ?> 

thanks replies , suggestions, below html form:

            <div id="map"></div>              <div class="dt-sc-margin50"></div>             <div class="container">                 <div class="column dt-sc-three-fourth first">                     <div class="hr-title">                         <h3>request call back</h3>                         <div class="title-sep">                         </div>                     </div>                     <form method="post" class="dt-sc-contact-form" action="php/send.php" name="frmcontact">                         <div class="column dt-sc-one-third first">                             <p> <span class="auto-style2">your name</span><span> <input type="text" placeholder="name*" name="txtname" maxlength="25" value="" required /> </span> </p>                         </div>                         <div class="column dt-sc-one-third">                             <p><span class="auto-style2">your email address<span> <input type="email" placeholder="email*" name="txtemail" value="" required /> </span> </p>                         </div>                         <div class="column dt-sc-one-third">                             <p><span class="auto-style2">your contact number <span> <input type="text" placeholder="phone" name="txtphone" value="" /> </span> </p>                         </div>                           <div class="column dt-sc-one-third first">                             <p><span class="auto-style2">company name <span> <input type="text" placeholder="company name" name="txtcomp" value="" /> </span> </p>                         </div>                         <div class="column dt-sc-one-third">                             <p><span class="auto-style2">no of employees <span> <input type="number" placeholder="no of employees" name="txtemp" value="" /> </span> </p>                         </div>                         <div class="column dt-sc-one-third">                             <p><span class="auto-style2">move in date <span> <input type="date" placeholder="move in date" name="txtmove" value="" /> </span> </p>                         </div>                           <p> <span class="auto-style2">please describe below kind of office looking for,we reply query on same day.<textarea placeholder="message*" name="txtmessage" maxlength "750"  required ></textarea> </p>                         <p> <input type="submit" value="send message" name="submit" /> </p>                     </form>                     <div id="ajax_contact_msg"></div>                 </div> 

update 01/10/15

hi guys

i made changes suggested dp , sebastianbrosch. website live again when attempt send form, says "the page save failed". below updated php code, html contact page file remains same.


hi apologies have pasted php code, reason, not showing in post. try again.

<?php if(!$_post) exit;  $to       = 'mydomain@email.com';  $name     = $_post['txtname']; $email    = $_post['txtemail']; $phone    = $_post['txtphone']; $comp     = $_post['txtcomp']; $emp      = $_post['txtemp']; $move     = $_post['txtmove']; $comment  = $_post['txtmessage'];  if(get_magic_quotes_gpc()) { $comment = stripslashes($comment); }    $subject = 'office enquiry via domain.com ' . $name . '.';   $msg  = "you have been contacted ".$name."\r\n\n";  $msg .= "you can contact ".$name." via email, ".$email.".\r\n\n";  $msg .= "you can call ".$name." on ".$phone.".\r\n\n";  $msg .= "$name has ".$emp." employees , company name ."$comp.".\r\n\n";  $msg .= $name." move in on ."$move.".\r\n\n";  $msg .= $comment."\r\n\n";    $msg .= "---------------------------------------------------------------\r\n";   if(@mail($to, $subject, $msg, "from: $email\r\nreturn-path: $email\r\n"))  {      echo "<span class='success-msg'>thanks contacting us, have received query , in touch soon.</span>";  }  else  {      echo "<span class='error-msg'>sorry message not sent, please try again or contact via live chat.</span>";  } ?> 

there missing points in front of = in following lines

$msg  = "you can call $name on $phone.\r\n\n"; $msg  = "$name has $emp employees , company name $comp.\r\n\n"; $msg  = "$name move in on $move.\r\n\n"; 

replace following lines

$msg  .= "you can call $name on $phone.\r\n\n"; $msg  .= "$name has $emp employees , company name $comp.\r\n\n"; $msg  .= "$name move in on $move.\r\n\n"; 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -