Jordan1987x Posted May 7, 2015 Share Posted May 7, 2015 How do i add an upload image option ((<input type="file" name="picture" />)) at the bottom of this form and get it to send the image with the form info to my email ? Everything works properly I just want the applicant to also be able to add a photo and send it with their info on the form and me receive it in the email...... Im new to all this.... any help would be greatly appreciated. Here is the current code: PHP CODE <?php $name = $_POST['name']; $email = $_POST['email']; $number = $_POST['number']; $alias = $_POST['alias']; $location = $_POST['location']; $age = $_POST['age']; $height = $_POST['height']; $weight = $_POST['weight']; $hair = $_POST['hair']; $eyes = $_POST['eyes']; $measurements = $_POST['measurements']; $nationality = $_POST['nationality']; $incalls = $_POST['incalls']; $outcalls = $_POST['outcalls']; $travel = $_POST['travel']; $work = $_POST['work']; $description = $_POST['description']; $comments = $_POST['comments']; $formcontent="Name: $name \n Number: $number \n Email: $email \n Alias: $alias \n Location: $location \n Age: $age \n Height: $height \n Weight: $weight \n Hair: $hair \n Eyes: $eyes \n Bust: $bust \n Waist: $waist \n Hips: $hips \n Nationality: $nationality \n Incalls: $incalls \n Outcalls: $outcalls \n Travel: $travel \n usCitizen: $citizen \n Availability: $work \n Description: $description \n Comments: $comments "; $recipient = "jordanmulcahy1987@gmail.com"; $subject = "Employment Application"; $mailheader = "Name: $email \r\n"; mail($recipient, $subject, $formcontent, $mailheader) or die("Error!"); header("Location: http://www.asecretcompanion.com"); ?> HTML CODE <form action="employment.php" method="POST" class="section1"> <h3>Employment Application</h3><p> Name:<input type="text" name="name" /><br> Number:<input type="text" name="number" maxlength="11" /><br> Email:<input type="text" name="email" /><br> Alias:<input type="text" name="alias" /><br> Location:<input type="text" name="location" /><br><br> Age:<input type="text" name="age" size="2" maxlength="2" /><br> Height:<input type="text" name="height" size="3" /><br> Weight:<input type="text" name="weight" size="3" maxlength="3" /><br> Hair:<input type="text" name="hair" size="5" /><br> Eyes:<input type="text" name="eyes" size="5" /><br> Measurements:<input type="text" name="measurements" size="5" /><br> Nationality:<input type="text" name="nationality" /><br><br> Incalls:<select name="incalls"> <option>Please Select</option> <option value="yes">Yes</option> <option value="no">No</option></select><br> Outcalls:<select name="outcalls"> <option>Please Select</option> <option value="yes">Yes</option> <option value="no">No</option></select><br> Travel:<select name="travel"> <option>Please Select</option> <option value="yes">Yes</option> <option value="no">No</option></select><br><br> Days/Hours Available To Work:<br><textarea name="work" rows="3" cols="25"></textarea><br /> Describe Your Personality:<br><textarea name="description" rows="3" cols="25"></textarea><br /> Questions and Comments:<br><textarea name="comments" rows="3" cols="25"></textarea><br /><br> <input type="submit" class="myButton" value="Submit Application"></form> thank you for your help -Jordan my host address is ent180.net16.net and i have an uploads folder in there too.... dont know if that info is needed? you can email me too at JordanMulcahy1987@gmail.com Quote Link to comment Share on other sites More sharing options...
fastsol Posted May 7, 2015 Share Posted May 7, 2015 There's a lot more code needed to achieve what you want. If you don't understand how to upload files via a form, I would suggest checking out phpacademy on youtube and watch some of his tutorials on the subject. Once you understand how to actually upload the file, then I would suggest simply storing the file on your server and just use a <img> tag with an absolute url in the href to view the image rather than sending the file in the email too. Sending email file attachments is a whole other subject in itself. One key piece of info, you'll want to set a couple additional headers in the email code. One specific would be the Content-Type of text/html. You can google stuff on that. But if you really want to make it easier in the long run and learn some too, get PHPMailer and use that to send your emails. It will automatically include all the needed things to properly send an email, it will also allow you to do easy attachments if you really wanted. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.