<form method='post' action='send.php'><label>To :</label><br><input type="text" name="to" placeholder="To"><label>From :</label><br><input type="text" name="to" placeholder="From"><label>Subject :</label><br><input type="text" name="to" placeholder="Subject"><textarea name="message"></textarea>
<?php$to = $_POST['to'];$from = $_POST['from'];$subject = $_POST['subject'];$message = $_POST['message'];$con=mysqli_connect("example.com","peter","abc123","my_db");// Check connectionif (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error();}mysqli_query($con,"INSERT INTO messages (to, from, subject, message)VALUES ('$to', '$from', '$subject', '$message')");mysqli_close($con);?>
This is just a code thrown together really quick. This is exactly how I would do it, without all the perfecting of the way it looks. I simply don't have my own code anymore. Because I removed it awhile back seeing as I couldn't find a solution to it.