No replies
jansch
jansch's picture
Offline
newbie
Last seen: 7 years 16 weeks ago
Timezone: GMT+1
Joined: 2016-02-04
Posts: 4
Points: 6

Hello,
I have been tampering with the contact form for many hours but it still does not work. Unfortunately, I have no knowledge of PHP.
Can you please be so good to correct the contact form?

Also very important: I do not want the textbox "username" to be present. Please remove it.

Very many thanks in advance!
Jan
PS: Hopingly, I have inserted the codes OK for.
----------------------

<form action="mail.php" method="POST">
				    <div class="row">
				        <div class="col-md-6">
				            <div class="form-group">
				                <label for="email">Email address</label>
				                <input type="email" class="form-control" id="email" placeholder="Enter email">
				            </div>
				        </div>
				        <div class="col-md-6">
				            <div class="form-group">
				                <label for="username">Username</label>
				                <input type="name" class="form-control" id="username" placeholder="Name">
				            </div>
				        </div>
				    </div>
				    <div class="form-group">
				        <label for="message">Message</label>
				        <textarea class="form-control" rows="3"></textarea>
				    </div>
				    <button type="submit" class="btn tf-btn btn-default">Submit</button>
</form>

--------------------------------

         $to = "[email protected]";
         $subject = "Email from ".$_POST['username'];
 
         $message = $_POST['message'];
 
 
         $header = "From:".$_POST['email']." \r\n"; 
         $header .= "MIME-Version: 1.0\r\n";
         $header .= "Content-type: text/html\r\n";
 
         $retval = mail ($to,$subject,$message,$header);
 
         if( $retval == true ) {
            echo "Message sent successfully...";
 
         }else {
            echo "Message could not be sent...";
         }
 

---------------------------------