php - On send submit button, email form data as doc -
i have code in when click send button, form data downloaded word document(.doc). require when click submit button, want .doc file emailed doc file attachment. trying local host now.
index.html
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <title>untitled document</title> <style> h1 { height: 50px; width: 100%; font-size: 18px; background: #ffa500; color: white; line-height: 150%; border-radius: 3px 3px 0 0; box-shadow: 0 2px 5px 1px rgba(0, 0, 0, 0.2); } h3 { height: 50px; width: 100%; font-size: 18px; background: white; color: #18aa8d; line-height: 150%; border-radius: 3px 3px 0 0; } form { box-sizing: border-box; width: 500px; margin: 100px auto 0; box-shadow: 2px 2px 5px 1px rgba(0, 0, 0, 0.2); padding-bottom: 40px; border-radius: 3px; } form h1 { box-sizing: border-box; padding: 20px; } .text-field { margin: 40px 25px; width: 80%; display: block; border: none; padding: 10px 0; -webkit-transition: 0.3s cubic-bezier(0.64, 0.09, 0.08, 1); transition: 0.3s cubic-bezier(0.64, 0.09, 0.08, 1); background: -webkit-linear-gradient(top, rgba(255, 255, 255, 0) 96%, #1abc9c 4%); background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 96%, #1abc9c 4%); background-position: -100% 0; background-size: 100% 100%; background-repeat: no-repeat; color: #0e6252; } .text-field:focus, .text-field:valid { box-shadow: none; outline: none; background-position: 0 0; border-bottom: solid 1px #1abc9c; } button { float:right; border: none; background: #1abc9c; cursor: pointer; border-radius: 3px; padding: 6px; width: 40px; color: white; margin-right: 40px; box-shadow: 0 3px 6px 0 rgba(0, 0, 0, 0.2); } button:hover { -webkit-transform: translatey(-3px); -ms-transform: translatey(-3px); transform: translatey(-3px); box-shadow: 0 6px 6px 0 rgba(0, 0, 0, 0.2); } .text-field-1 { background:none; } </style> </head> <body> <form method="post" action="word.php"> <h1>resume</h1> <h3>career objective:</h3> <textarea rows="3" cols="6" name="obj" placeholder="objective" class="text-field text-field-1"></textarea> <h3>personal details:</h3> <input placeholder="name" name="name" class="text-field" type="text" required=""> <textarea rows="3" cols="6" name="address" placeholder="address" class="text-field text-field-1"></textarea> <input placeholder="phone number" name="number" class="text-field" type="text" required=""> <input placeholder="email" name="email" class="text-field" type="text" required=""> <input placeholder="dob-dd/mm/yyy" name="dob" class="text-field" type="text" required=""> <input placeholder="nationality" name="nation" class="text-field" type="text" required=""> <input placeholder="maritial status" name="status" class="text-field" type="text" required=""> <h3>education:</h3> <textarea rows="6" cols="12" name="education" placeholder="10th, 12th , graduation" class="text-field text-field-1"></textarea> <h3>experiance:</h3> <textarea rows="6" cols="12" name="exper" placeholder="company , years worked" class="text-field text-field-1"></textarea> <h3>languages:</h3> <textarea rows="6" cols="12" name="lang" placeholder="languages known" class="text-field text-field-1"></textarea> <h3>skills:</h3> <textarea rows="6" cols="12" name="skill" placeholder="skills" class="text-field text-field-1"></textarea> <h3>intersts:</h3> <textarea rows="6" cols="12" name="interest" placeholder="interests" class="text-field text-field-1"></textarea> <h3>projects:</h3> <textarea rows="6" cols="12" name="project" placeholder="projects" class="text-field text-field-1"></textarea> <h3>personal qualities:</h3> <textarea rows="6" cols="12" name="qual" placeholder="your personal qualities" class="text-field text-field-1"></textarea> <h3>achievements:</h3> <textarea rows="6" cols="12" name="achievements" placeholder="achievements" class="text-field text-field-1"></textarea> <h3>references:</h3> <textarea rows="6" cols="12" name="references" placeholder="references" class="text-field text-field-1"></textarea> <button type="submit" name="word">doc</button> </form> </body> </html> <!-- <input placeholder="heading" name="heading" class="text-field" type="text" required=""> <textarea rows="3" cols="6" name="content" placeholder="content" class="text-field text-field-1"></textarea> -->
word.php
<?php if(isset($_post['word'])){ header("content-type: application/vnd.ms-word"); # replace wordfile.doc whatever want filename default header("content-disposition: attachment;filename=resume.doc"); header("pragma: no-cache"); header("expires: 0"); $current_date = date('d-m-y'); $obj = $_post['obj']; $name = $_post['name']; $address = $_post['address']; $number = $_post['number']; $email = $_post['email']; $dob = $_post['dob']; $nation = $_post['nation']; $status = $_post['status']; $education = $_post['education']; $exper = $_post['exper']; $lang = $_post['lang']; $skill = $_post['skill']; $interest = $_post['interest']; $project = $_post['project']; $qual = $_post['qual']; $achievements = $_post['achievements']; $references = $_post['references']; echo "report date: $current_date \n\n"; echo "career objective:\n\n"; echo "$obj \n\n"; echo "personal details:\n\n"; echo "name: $name\n\n"; echo "address: $address\n\n"; echo "phone number: $number\n\n"; echo "e-mail: $email\n\n"; echo "date of birth: $dob\n\n"; echo "nationality: $nation\n\n"; echo "maritial status: $status\n\n"; echo "education:\n\n"; echo "$education \n\n"; echo "experiance:\n\n"; echo "$exper \n\n"; echo "languages:\n\n"; echo "$lang \n\n"; echo "skills:\n\n"; echo "$skill \n\n"; echo "interest:\n\n"; echo "$interest \n\n"; echo "project:\n\n"; echo "$project \n\n"; echo "achievements:\n\n"; echo "$achievements \n\n"; echo "personal qualities:\n\n"; echo "$qual \n\n"; echo "references:\n\n"; echo "$references \n\n"; } ?>
any appreciated. thankyou
Comments
Post a Comment