Click here to Skip to main content
15,884,388 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
Hi,

I'm new in HTML & PHP & I hope to get some help with my send your info form.

I created sendyourinfo.html page ,after testing it online ,I can't get all required information in email.

The following is the page code:

<!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=utf-8" />
<title>Contact Us - Harmony Of Targets</title>
<link href="oneColLiqCtrHdr.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
body {
background-color: #838383;
}
body,td,th {
font-family: Eras Medium ITC, Georgia, Calibri;
}
.style1 {font-size: small}
.style2 {font-size: medium}
.style3 {font-size: x-large}
-->
</style>
<script type="text/javascript">
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x>}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length;> if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++)> for(i=0;!x&&d.layers&&i<d.layers.length;i++)> if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>

<body class="oneColLiqCtrHdr" onload="MM_preloadImages('buttons/home2en.jpg','buttons/aboutus2en.jpg','buttons/ourservices2en.jpg','buttons/sendyourinfo2en.jpg','buttons/contactus2en.jpg','buttons/arabic2en.jpg')">





If your're looking for new job or want to change your current's, We recommend to provide us your information by filling the below form:






<form action="sendyourinfo-en.php" method="post" enctype="multipart/form-data">


Apply to job Form


 


Name <label>
<input type="text" name="fullname" id="tswname" size="24" />
</label>
Gender <label>
<select name="GenderList" id="GenderList">
<option value="choose one">Choose One...</option>
<option value="male">Male</option>
<option value="female">Female</option>
</select>
</label>
Date Of Bith "Years" <input name="DOB" type="text" id="DOB" size="4" maxlength="4" />
Nationality <input type="text" name="Nationality" id="Nationality" />
Current City <input type="text" name="CurrentCity" id="CurrentCity" />
Mobile No. <input name="MobNo" type="text" id="MobNo" maxlength="20" />
Email <input type="text" id="tswemail" name="email" size="24" />
Experiense "Years" <input name="ExpYears" type="text" id="ExpYears" size="2" maxlength="2" />
Experiense Field <label>
<select name="ExpList" id="ExpList">
<option value="choose one" selected="selected">Choose One...</option>
<option value="mngmt-gm">Management - GM</option>
<option value="mngmt-others">Management - Others</option>
<option value="hr-manager">HR - Manager</option>
<option value="hr-admin">HR - Admin</option>
</select>
</label>
Upload your CV <label>
<input name="fileupload" type="file" id="fileupload" size="24" />
</label>
  <input type="reset" name="Clear" id="Clear" value="Clear" />
<input name="Submit" type="submit" value="Send" />

<label for="tswname">



</label>
</form>




<!-- end #container -->

</body>
</html>

Also, the script code:

if(isset($_POST['submit']))
{
//Confirmation messeage
$confirmation = '

Thanks for sending your file and comments

';
//hide from when sent successfully
$hideForm = 'style="display:none;"';

//Email recipient and sublect message
$to = 'info@htksa.com ';
$subject = 'Feedback Form';


$fullname = trim($_POST['fullname']);
$email = trim($_POST['email']);
$comments = strip_tags($_POST['comments']);
$attachment = chunk_split(base64_encode(file_get_contents($_FILES['file']['tmp_name'])));
$filename = $_FILES['file']['name'];


// build email message
$message .= "Name: $fullname\n\n";
$message .= "Email Address: $email\n\n";
$message .= "Comments: $comments\n\n";


$boundary =md5(date('r', time()));

$headers = "From: your@domain.com\r\nReply-To: your@emailaddress.com";
$headers .= "\r\nMIME-Version: 1.0\r\nContent-Type: multipart/mixed; boundary=\"_1_$boundary\"";

// build message
$message = "Name: $fullname\n\n";
$message .= "Email Address: $email\n\n";
$message .= "Comments: $comments\n\n";

$message="


--_1_$boundary
Content-Type: multipart/alternative; boundary=\"_2_$boundary\"

--_2_$boundary
Content-Type: text/plain; charset=\"iso-8859-1\"
Content-Transfer-Encoding: 7bit

$message

--_2_$boundary--
--_1_$boundary
Content-Type: application/octet-stream; name=\"$filename\"
Content-Transfer-Encoding: base64
Content-Disposition: attachment

$attachment
--_1_$boundary--";


mail($to, $subject, $message, $headers);
}
?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>File Attchment</title>
</head>

<body>




<form enctype="multipart/form-data" action="" method="post" class="style1">

<label for="tswname">Name</label>
<input type="text" name="fullname" id="tswname" size="33" />



<label for="tswemail">Email</label>
<input type="text" name="email" id="tswemail" size="33" />




<label for="file">Select file to upload:</label>
<input type="file" name="file" id="file">



<label for="comments">Comments</label>

<textarea rows="15" cols="45" name="comments" id="tswcomments"></textarea>


<input type="submit" name="submit" id="submit" value="send">


</form>
</body>
</html>

So, Is there any way to fix the problem?
Posted
Comments
Mohibur Rashid 24-Jun-15 19:28pm    
It's not easy to help you with ypur code dumping.
Member 11790148 24-Jun-15 19:31pm    
So, What's the good solution for them ???
Mohibur Rashid 24-Jun-15 20:13pm    
Try to find out where exactly you are having hard time.
Is HTML FORM failing to send data to your server-side? Which is unlikely. use print_r($_POST); or print_r($_GET); to find out if your send data and received data are same or not.
Also open your php.ini file and make sure your
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
display_errors=On
display_startup_errors = On
this way, you will know if you are accessing your variables properly or not.
Learning MIME protocol is not bad. But if you want you can use other tools for that.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900