Click here to Skip to main content
15,889,096 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I made a form to email the data to an email ID.
But on filling up the form and submitting, the browser is saying - Server error. The website encountered an error while retrieving http://localhost/process.php.

Here is the code -

form1.html

XML
<html>
<head>
<title>Form</title>
</head>
<body>

<form method = "post" action = "process.php">
Enter your name <input type = "text" name = "namee" id = "namee" value = "enter your name" />
Enter your phone number <input type = "text" name = "phone" id = "phone" />
<br>
<input type  = "submit" value = "post it!" />
</form>


</body>
</html>


process.php

XML
<?php

$person_name = $_POST["namee"];
$person_number = $_POST["phone"];

$to = "example234671_1@gmail.com";
$subject = "form filled up";
$body = $person_name. "<br>" $person_number . "<br>" . $person_name ;


mail($to, $subject, $body);

echo "Thank you!" ;
?>


What is the error ??
Posted

1 solution

I had missed out a conacatenator.

XML
There's a syntax error here.

$body = $person_name. "<br>" $person_number . "<br>" . $person_name ;
"<br>" 

needs to be followed by a concatenation dot, like so:

$body = $person_name. "<br>" . $person_number . "<br>" . $person_name ;
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900