-1

i am using following code for email send

<?php
if(isset($_POST['submit']))
{
$name = htmlspecialchars($_REQUEST['name']);

$email = htmlspecialchars($_REQUEST['email']);

$mobile = htmlspecialchars($_REQUEST['mobile']);

$company = htmlspecialchars($_REQUEST['company']);

$qty = htmlspecialchars($_REQUEST['qty']);

//$upload = htmlspecialchars($_REQUEST['upload']);

$msg = htmlspecialchars($_REQUEST['msg']);
}

$to="example@gmail.com";

$subject = "Order Information";

$message.= "FirstName: " . $name . "\n";

$message .= "Email: " . $email . "\n";

$message .= "ContactNo: " . $mobile . "\n";

$message .= "Company: " . $company . "\n";

$message .= "Quantity: " . $qty . "\n";

//$message .= "Upoload: " . $upload . "\n";

$msg = "Message: " . $msg . "\n";


if(mail($to, $subject, $message))
{   echo 'thank you';   }
else{ echo 'error';}

?>

it sends email successfully but ail fields in email message get as: FirstName: Email: ContactNo: Company: Quantity:

please suggest what is wrong with code ???

Phiter
  • 14,570
  • 14
  • 50
  • 84
GOVINDA MAHAJAN
  • 43
  • 2
  • 12

2 Answers2

0

The value for submit is empty .. try with this

<input type="submit" name="submit" value="submit" />

OR

<input type="hidden" name="submit" value="submit" />
<button type="submit" name="btn">Submit</button>
Yuvaraj R
  • 1
  • 2
0

Form method must using Post example :

<form method='POST' name='test'>your input n button </form>
Sven R.
  • 1,049
  • 17
  • 24