-2

Having an inquiry form in my website unable to send an email after entering an email and click on submit getting as "Mail could not be sent".It is redirecting to another and displaying the message.Need to display the message on the same page.Here is the code:

index.php

<form action="contact.php" method="post"  enctype="multipart/form-data">
  <input type="email" size="30" placeholder=" Enter your Email and Get Notified..."  name="email" id="email">
  <a href="#"><button type="submit" class="btn span btn-4 btn-4a icon-arrow-right"><span></span></button></a>
  <div id="response"></div>
</form>

contact.php:

<?php

$connection = mysql_connect("localhost", "mk_group", "12345") or die(mysql_error());
$db = mysql_select_db("group", $connection);    
$email = $_POST['email'] ;
$sql2 = mysql_query("insert into contact_us(email) values ('$email')");
if ($sql2) 
{
 $to = "xxx@gmail.com,yyy@gmail.com";
 $subject = 'the subject';
 $message = 'hello';         
 $retval = mail ($to,$subject,$message);         
 echo "Message sent successfully...";
}else {
  echo "Message could not be sent...";
}
?>
user6728960
  • 275
  • 1
  • 4
  • 13

1 Answers1

1

Function mail(string $to , string $subject , string $message) requires 3 arguments and you set just one

Artem Ilchenko
  • 1,050
  • 9
  • 20