0

I am unable to understand why this error comes.. I am trying to run a mail sending using my html page, and it keeps on showing this.

This is my php code

<?php

  $from_name = $_POST['name']
  $from_email = $_POST['email']
  $subject = $_POST['subject']
  $message = $_POST['message']

  $mailheader = "From:".$from_name."<".$from_email.">\r\n"
  $receiving_email_address = 'myemail@gmail.com';
  
  mail($receiving_email_address,$subject,$message,$mailheader)
  or die("Error!")

  echo ("Thank you for Visiting our website,Message has been received :)");

?>




Parse error: syntax error, unexpected variable "$from_email" This is the error im getting

Akhil
  • 9
  • 1
  • Are you sure that is the code you are using? It should be syntax error from the start because there is no `;` at end of the line. – vee Dec 13 '22 at 03:25

1 Answers1

0

Just add ; in each variable's end of line.

$from_name = $_POST['name'];
$from_email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];

taaaadaaaaaa It will work.

Piyush Sapariya
  • 408
  • 3
  • 11