Why is my php script not send the contact form to my email? -


i tried creating simple php script send email me when fills out contact form on website nan error says:

inspirehealth.today unable handle request. http error 500

<?php  $first_name = $_post('first_name'); $last_name = $_post('last_name'); $email = $_post('email'); $message = $_post('message');  $to = "lewkowicz613@gmail.com"; $subject = "message inspire health";  mail ($to, $subject, $message, "from: " . $first_name . $last_name); echo "your message has been sent";  ?> 

and here html file relevant form

<section class="section-form js--contact" id="contact">     <div class="row">         <h3>please subscribe our email list!</h3>     </div>     <div class="row">         <form method="post" action="form_process.php" class="contact-form">             <div class="row">                 <div class="col span-1-of-3">                     <label for="first_name">first name</label>                 </div>                 <div class="col span-2-of-3">                     <input type="text" name="first_name" id="first_name" placeholder="first name" required>                 </div>             </div>             <div class="row">                 <div class="col span-1-of-3">                     <label for="last_name">last name</label>                 </div>                 <div class="col span-2-of-3">                     <input type="text" name="last_name" id="last_name" placeholder="last name" required>                 </div>             </div>             <div class="row">                 <div class="col span-1-of-3">                     <label for="email">email</label>                 </div>                 <div class="col span-2-of-3">                     <input type="email" name="email" id="email" placeholder="your email" required>                 </div>             </div>             <div class="row">                 <div class="col span-1-of-3">                     <label for="message">drop line</label>                 </div>                 <div class="col span-2-of-3">                     <textarea name="message" id="message" placeholder="your message" ></textarea>                 </div>             </div>             <div class="row">                 <div class="col span-1-of-3">                     <label>&nbsp;</label>                 </div>                 <div class="col span-2-of-3">                     <input type="submit" value="send it!">                 </div>             </div>         </form>     </div> </section> 

im not sure why not working properly. server thing because uploaded files domain root directory. lot.

$_post global array, try:

<?php $first_name = $_post['first_name']; $last_name = $_post['last_name']; $email = $_post['email']; $message = $_post['message'];  $to = "lewkowicz613@gmail.com"; $subject = "message inspire health";  mail ($to, $subject, $message, "from: " . $first_name . $last_name); echo "your message has been sent";  ?> 

hope helps :)


Comments

Popular posts from this blog

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -

python - Error while using APScheduler: 'NoneType' object has no attribute 'now' -