Hey guys I'm having trouble capturing the value from my textarea in this form, I can read the first values of name and email but when the php code tries to read the Message of textarea it returns an error. Can someone please help me figure out what is wrong with my code? By the way I am still writing here since I need to fill up this space but this sentence is not really relevant to the question. Thanks!
HTML:
<form action="form_process.php" method="post">
<div class="row">
<div class="col-lg-6 text-center col-md-8 ml-auto mr-auto">
<div class="input-group input-lg">
<span class="input-group-addon">
<i class="now-ui-icons users_circle-08"></i>
</span>
<input type="text" class="form-control" placeholder="First Name..." name="Name">
</div>
<div class="input-group input-lg">
<span class="input-group-addon">
<i class="now-ui-icons ui-1_email-85"></i>
</span>
<input type="text" class="form-control" placeholder="Email..." name="Email">
</div>
<form class="" action="form_process.php" method="post">
<div class="textarea-container">
<p>
<textarea class="form-control" name="name" rows="4" cols="80" placeholder="Type a message..." name="MessageForMe"></textarea>
</p>
</div>
</form>
<div class="send-button">
<input class="btn btn-primary btn-round btn-block btn-lg" type="submit" value="Submit" />
</div>
</div>
</div>
</form>
PHP:
<!DOCTYPE html>
<html>
<body>
<?php
$con = mysqli_connect("localhost","benji3pr","Benji3pr","Contact Form");
//if we dont connect
if(mysqli_connect_errno())
{
echo "Failed to connect" . mysqli_connect_error();
}
//if we connect
if(mysqli_ping($con))
{
echo "Connection Ok!!!";
}
else
{
echo "Error: " . mysqli_error($con);
}
$name = $_POST['Name'];
$email = $_POST['Email'];
$message = $_POST['MessageForMe'];
echo (' ' . $name . ' ' . $email . ' ' . $message);
$sql = "INSERT INTO Contact Form (Name, Email, Message) VALUES ('$name',
'$email', '$message')";
if (!mysqli_query($sql)){
die('Error: ' . mysqli_error());
}
mysqli_close($con);
?>
</body>
</html>