windows 10 pro office 2019 pro office 365 pro windows 10 home windows 10 enterprise office 2019 home and business office 2016 pro windows 10 education visio 2019 microsoft project 2019 microsoft project 2016 visio professional 2016 windows server 2012 windows server 2016 windows server 2019 Betriebssysteme office software windows server https://softhier.com/ instagram takipçi instagram beğeni instagram görüntüleme instagram otomatik beğeni facebook beğeni facebook sayfa beğenisi facebook takipçi twitter takipçi twitter beğeni twitter retweet youtube izlenme youtube abone instagram

how to send an email through a web questionaire?

Asked By: Anonymous

So I have the following set of forms in the like of "form-control" (from bootstrap) and you get 3 different forms to fill in: title, email and the message itself

                    <form class="main_form">
                        <div class="row">
                         
                            <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12">
                                <input class="form-control" placeholder="title" type="text" name="Title">
                            </div>
                            <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12">
                                <input class="form-control" placeholder="Email" type="text" name="Email">
                            </div>
                            <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12">
                                <textarea class="textarea" placeholder="message" type="text" name="Message"></textarea>
                            </div>
                            <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12">
                                <button class="send" >send</button>
                            </div>
                        </div>
                    </form>

My question is, how do you retrieve the info from the form-control’s? And then, use that information to send this other script (pressing the send button):

<?php
function send_mail( $subject, $message, $headers){
    // https://stackoverflow.com/questions/5335273/how-can-i-send-an-email-using-php
    $to = "[email protected]";
    mail($to, $subject, $message, $headers);
}
?>

Solution

Answered By: Anonymous

we can write send mail function in the same file where this form html code written but only for seperation purpose, we create a separate php file named as "sendmail.php".
put the filename in the action method of form. $_POST is a PHP super global variable which is used to collect form data after submitting an HTML form with method="post".

 <form class="main_form" method="post" action ="sendmail.php">
    <div class="row">          
    <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12">
        <input class="form-control" placeholder="title" type="text" name="Title">
    </div>
    <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12">
        <input class="form-control" placeholder="Email" type="text" name="Email">
    </div>
    <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12">
        <textarea class="textarea" placeholder="message" type="text" name="Message"></textarea>
    </div>
    <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12">
        <input class="send" type="submit" value="send" name="submitted_form">
    </div>
</div>
</form>

sendmail.php

<?php
  if (isset($_POST['submitted_form'])){
    $subject = $_POST['Title'];
    $message = "Email : $_POST['Email'] Message: $_POST['Message']";
    $headers = "From:[email protected]";
    send_mail($subject,$message,$headers);
  }
function send_mail( $subject, $message, $headers){
    // https://stackoverflow.com/questions/5335273/how-can-i-send-an-email-using-php
    $to = "[email protected]";
    if(mail($to, $subject, $message, $headers)){
        echo "Message sent successfully...";
     }else {
        echo "Message could not be sent...";
     }
}
?>

techinplanet staff


Windows 10 Kaufen Windows 10 Pro Office 2019 Kaufen Office 365 Lizenz Windows 10 Home Lizenz Office 2019 Home Business Kaufen windows office 365 satın al follower kaufen instagram follower kaufen porno