Jump to content

hashir

New Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by hashir

  1. I tried to create the inquiry form fronted on html and backhand on php. the purpose of the form use can fill their personal details and attach their image after submit the all data with picture will be email to admin. i wrote this code but fail to execute successfully. <?php //errors $phone = "test number"; // check line 161 $_POST['title'] =""; // somehow its turning into an array if(!$_POST) exit; // Email address verification, do not edit. function isEmail($email) { return(preg_match("/^[-_.[:alnum:]]+@((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)$|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i",$email)); } if (!defined("PHP_EOL")) define("PHP_EOL", "\r\n"); //$file_name = $_FILES['file_name']; $file_name =$_FILES["file_name"]["tmp_name"]; $file_data = base64_encode( file_get_contents($file_name)); $title = $_POST['title']; $gender = $_POST['gender']; $maritalStatus = $_POST['maritalStatus']; $name = $_POST['name']; $fatherName = $_POST['fatherName']; $dob = $_POST['dob']; $email = $_POST['email']; $postalAddress = $_POST['postalAddress']; $PTCLno = $_POST['PTCLno']; $mobileNumber1 = $_POST['mobileNumber1']; $matricBoard = $_POST['matricBoard']; $intermediateBoard = $_POST['intermediateBoard']; $group = $_POST['group']; $totalMarksMatric = $_POST['totalMarksMatric']; $marksObtnMatric = $_POST['marksObtnMatric']; $examTypeMatric = $_POST['examTypeMatric']; $passingYear = $_POST['passingYear']; $percentageMatric = $_POST['percentageMatric']; $nameOfCollege = $_POST['nameOfCollege']; $collegeEmailAddress = $_POST['collegeEmailAddress']; $postelAddressOfCollege = $_POST['postelAddressOfCollege']; $telephoneNumberOfCollege = $_POST['telephoneNumberOfCollege']; $collegePrincipleName = $_POST['collegePrincipleName']; $collegePrincipleCellNo = $_POST['collegePrincipleCellNo']; $referenceName = $_POST['referenceName']; $reference1InstituteName = $_POST['reference1InstituteName']; $collegePrincipleCellNo = $_POST['reference1InstituteName']; $reference1CellNo = $_POST['reference1CellNo']; $reference1Address = $_POST['reference1Address']; $reference2InstituteName = $_POST['reference2InstituteName']; $reference2CellNo = $_POST['reference2CellNo']; $reference2Address = $_POST['reference2Address']; $question1 = $_POST['question1']; $question2 = $_POST['question2']; $question3 = $_POST['question3']; $question4 = $_POST['question4']; $question5 = $_POST['question5']; $accountTitle = $_POST['accountTitle']; $accountNo = $_POST['accountNo']; $nameOfBank = $_POST['nameOfBank']; $branchAddress = $_POST['branchAddress']; $CNICofAccHolder = $_POST['CNICofAccHolder']; $cellNoOfAccHolder = $_POST['cellNoOfAccHolder']; $examCity = $_POST['examCity']; $terms = $_POST['terms']; if(trim($name) == '') { echo '<div class="alert alert-error">You must enter your name.</div>'; exit(); } else if(trim($email) == '') { echo '<div class="alert alert-error">You must enter email address.</div>'; exit(); } else if(!isEmail($email)) { echo '<div class="alert alert-error">You must enter a valid email address.</div>'; exit(); } if(get_magic_quotes_gpc()) { $comments = stripslashes($comments); } // Configuration option. // Enter the email address that you want to emails to be sent to. // Example $address = "joe.doe@yourdomain.com"; //$address = "hashir_252@hotmail.com"; $address = "hashir_252@hotmail.com"; // Configuration option. // i.e. The standard subject will appear as, "You've been contacted by John Doe." // Example, $e_subject = '$name . ' has contacted you via Your Website.'; $e_subject = 'Contact Form'; // Configuration option. // You can change this if you feel that you need to. // Developers, you may wish to add more fields to the form, in which case you must be sure to add them here. $e_body = "You have been contacted by $name, their additional message is as follows." . PHP_EOL . PHP_EOL; $e_content = "\" Picture: ".'<img src="data:image/png;base64,'.$file_data.'" alt="beastie.png">'." \n Personal Information \n Title: $title \n Gender: $gender \n Martial Status: $maritalStatus \n Name: $name \n Father Name: $fatherName \n Date of Birth: $dob \n Email ID: $email \n Postal Address: $postalAddress \n Ptcl: $PTCLno \n Mobile Number: $mobileNumber1 \n Academic Information \n Matric Board: $matricBoard \n Intermediate Board: $intermediateBoard \n Group: $group \n Total Marks Matric: $totalMarksMatric \n Marks Obtain: $marksObtnMatric \n Exam Type: $examTypeMatric \n Passing Year: $passingYear \n Percentage Matric: $percentageMatric \n College Information \n Name of College: $nameOfCollege \n College Email Address: $collegeEmailAddress \n Postal Address College: $postelAddressOfCollege \n Telephone Number: $telephoneNumberOfCollege \n Principle Name: $collegePrincipleName \n Principle Cell Number: $collegePrincipleCellNo \n References \n Refrence Name: $referenceName \n Refrence Institute Name: $reference1InstituteName \n Refrence Cell Number: $reference1CellNo \n Refrence Address: $reference1Address \n Refrence 2 Name: $reference2InstituteName \n Refrence Cell Number: $reference2CellNo \n Refrence Address: $reference2Address \n Questions and Answers \n Question1: $question1 \n Question2: $question2 \n Question3: $question3 \n Question4: $question4 \n Question5: $question5 \n Banking Information \n Account Title: $accountTitle \n Account Number: $accountNo \n Bank Name: $nameOfBank \n Branch Address: $branchAddress \n Cnic#: $CNICofAccHolder \n Cell Number: $cellNoOfAccHolder \n Select the city where you would like to take the exam \n Exam City: $examCity \n Terms: $terms\"" . PHP_EOL . PHP_EOL; $e_reply = "You can contact $name via email: $email or via phone: $phone"; $msg = wordwrap( $e_body . $e_content . $e_reply, 70 ); $headers = "From: $email" . PHP_EOL; $headers .= "Reply-To: $email" . PHP_EOL; $headers .= "MIME-Version: 1.0" . PHP_EOL; $headers .= "Content-type: text/plain; charset=utf-8" . PHP_EOL; $headers .= "Content-Transfer-Encoding: quoted-printable" . PHP_EOL; // //////////////////////////////////////////////////// REMOVE THESE LINES $msg="<html><head></head><body>".$msg."</body></html>"; echo $msg; exit(); ///////////////////////////////////////////////////// REMOVE THESE LINES if(mail($address, $e_subject, $msg, $headers)) { // Email has sent successfully, echo a success page. echo "<div class='alert alert-success'>"; echo "<h3>Email Sent Successfully.</h3><br>"; echo "<p>Thank you <strong>$name</strong>, your message has been submitted to us.</p>"; echo "</div>"; } else { echo 'ERROR!'; }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.