<?php $Message_sent = false; if(isset($_POST['email']) && $_POST['email'] != ' '){ if( filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) ){ $userName = $_POST['inputNmae']; $userEmail = $_POST['inputEmail']; $message = $_POST['inputMessage']; $fileOne = $_POST['inputFileOne']; $fileTwo = $_POST['inputFileTwo']; $fileThree = $_POST['inputFileThree']; $fileFour = $_POST['inputFileFour']; $to = "my@email.com"; $body = ""; $body .= "From: \r\n".$userName. "\r\n\r\n"; $body .= "Email: \r\n".$userEmail. "\r\n\r\n"; $body .= "Message: \r\n".$message. "\r\n\r\n"; $body .= "File 1: \r\n".$fileOne. "\r\n\r\n"; $body .= "File 2: \r\n".$fileTwo. "\r\n\r\n"; $body .= "File 3: \r\n".$fileThree. "\r\n\r\n"; $body .= "File 4: \r\n".$fileFour. "\r\n\r\n"; mail($to,$messageSubject,$body); $Message_sent = true; } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <META HTTP-EQUIV=REFRESH CONTENT="5;URL=index.html"> </head> <body> <form action="mail.php" method="POST"> <label for="name">Name</label> <input type="text" name="inputNmae" id="name"> <label for="email">Email</label> <input type="email" name="inputEmail" id="email"> <label for="fileOne">Upload the summer photo</label> <input type="file" name="inputFileOne" id="fileOne"> <p>your can only upload a file in the format of .jpg or .png</p> <label for="fileTwo">Upload the fall photo</label> <input type="file" name="inputFileTwo" id="fileTwo"> <p>your can only upload a file in the format of .jpg or .png</p> <label for="fileThree">Upload the winter photo</label> <input type="file" name="inputFileThree" id="fileThree"> <p>your can only upload a file in the format of .jpg or .png</p> <label for="fileFour">Upload the spring photo</label> <input type="file" name="inputFileFour" id="fileFour"> <p>your can only upload a file in the format of .jpg or .png</p> <label for="message">Message</label> <textarea name="inputMessage" id="message" cols="30" rows="10"></textarea> </form> <?php if($Message_sent): ?> <div> <p>Your files have been uploaded to <br> The first picture <span id="theFirstPictureRoot"></span> The second picture <span id="theSecondPictureRoot"></span> The third picture <span id="theThirdPictureRoot"></span> The fourth picture <span id="theFourth PictureRoot"></span> </p> <a href="" id="downloadZipFile">Download zip file</a> </div> <?php else: ?> <?php endif; ?> </body> </html>
www.php.net
$userName = $_POST['inputName'];
$body .= "From: \r\n".$_POST['inputName']."\r\n\r\n";
foreach($_POST as $item){ echo $item; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)