Created
March 21, 2017 19:06
-
-
Save mikhy888/1ec424a3a1bb53ae462adb22c9a07b6c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$firstname = $secondname = $phone = $email = $message = ""; | |
if ($_SERVER["REQUEST_METHOD"] == "POST") { | |
$firstname = test_input($_POST["firstname"]); | |
$secondname = test_input($_POST["secondname"]); | |
$phone = test_input($_POST["phone"]); | |
$email = test_input($_POST["email"]); | |
$detail = test_input($_POST["message"]); | |
$messagemain = 'Firstname' . $firstname ."\r\n" . | |
'Secondname' . $secondname ."\r\n" . | |
'Phonenumber' . $phone ."\r\n" . | |
'Email' . $email ."\r\n" . | |
'Message' . $detail ; | |
$to = '[email protected]'; | |
$subject = 'Message from user'; | |
$message = $messagemain; | |
$headers = 'From: [email protected]' . "\r\n" . | |
'Reply-To: [email protected]' . "\r\n" . | |
'X-Mailer: PHP/' . phpversion(); | |
mail($to, $subject, $message, $headers); | |
header("location:contact.php"); | |
} | |
function test_input($data) { | |
$data = trim($data); | |
$data = stripslashes($data); | |
$data = htmlspecialchars($data); | |
return $data; | |
} | |
?> | |
<?php | |
$firstnamef = $secondnamef = $companynamef = $messagef = ""; | |
// if ($_SERVER["REQUEST_METHOD"] == "POST") { | |
if (isset($_POST["submitf"])) { | |
$firstnamef = test_input($_POST["firstnamef"]); | |
$secondnamef = test_input($_POST["secondnamef"]); | |
$companynamef = test_input($_POST["companynamef"]); | |
$messagef = test_input($_POST["messagef"]); | |
$messagemainf = 'Firstname' . $firstnamef ."\r\n" . | |
'Secondname' . $secondnamef ."\r\n" . | |
'Company Name' . $companynamef ."\r\n" . | |
'Message' . $messagef ; | |
$tof = '[email protected]'; | |
$subjectf = 'Message from user'; | |
$messagef = $messagemainf; | |
$headersf = 'From: [email protected]' . "\r\n" . | |
'Reply-To: [email protected]' . "\r\n" . | |
'X-Mailer: PHP/' . phpversion(); | |
mail($tof, $subjectf, $messagef, $headersf); | |
header("location:footer-form.php"); | |
} | |
function test_input($data) { | |
$data = trim($data); | |
$data = stripslashes($data); | |
$data = htmlspecialchars($data); | |
return $data; | |
} | |
?> | |
<form class="pr-form" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"> | |
<div class="input-con"> | |
<input type="text" placeholder="First Name" name="firstname"> | |
<input type="text" placeholder="Second Name" name="secondname"> | |
</div> | |
<div class="input-con"> | |
<input type="text" placeholder="Phone Number" name="phone"> | |
<input type="text" placeholder="Email" name="email"> | |
</div> | |
<div class="input-con"> | |
<textarea placeholder="Message" name="message"></textarea> | |
</div> | |
<input type="submit" value="Submit" name="submit"> | |
</form> | |
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"> | |
<div class="footer-text-fields"> | |
<input type="text" placeholder="FIRST NAME" name="firstnamef"> | |
<input type="text" placeholder="SECOND NAME" class="right-text" name="secondnamef"> | |
<input type="text" placeholder="CONPANY NAME" class="comp_name" name="companynamef"> | |
<textarea placeholder="MESSAGE" name="messagef"></textarea> | |
<input type="submit" class="submit" name="submitf" value="SUBMIT"> | |
</div> | |
</form> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment