logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > HTML and CSS
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 08-31-2013, 02:56 PM   #1
srijan.kuls
 
Join Date: Aug 2013
Posts: 4
Default I'm having trouble submitting all field values simultaneously to an email id.

<!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>
<title>Feedback Form</title>
</head>
<body>
<h1>Send Us Your Feedback!</h1>
<form action="send_mail.php" method="post" enctype="multipart/form-data">
<table>
<tr>
<td width="120">Name</td>
<td width="317"><label>
<input type="text" name="name" id="name" />
</label></td>
</tr>
<tr>
<td>Mob No</td>
<td><label>
<input type="text" name="mobile" id="mobile" />
</label></td>
</tr>
<tr>
<td>Email Adress:</td>
<td><input type="text" name="email_address" value="" maxlength="100" /></td>
</tr>
<tr>
<td>attach cv</td>
<td><label>
<input type="file" name="cv" id="cv" />
</label></td>
</tr>
<tr>
<td>Comments:</td>
<td>
<textarea rows="10" cols="50" name="comments"></textarea></td>
</tr>
<tr><td>&nbsp;</td>
<td>
<input type="submit" value="Submit" /></td>
</tr>
</table>
</form>
</body>
</html>














<?php
/*
This first bit sets the email address that you want the form to be submitted to.
You will need to change this value to a valid email address that you can access.
*/
$webmaster_email = "jobs@rtconsultants.in";

/*
This bit sets the URLs of the supporting pages.
If you change the names of any of the pages, you will need to change the values here.
*/
$feedback_page ="post_resume.html";
$error_page = "error_message.html";
$thankyou_page = "thank_you.html";

/*
This next bit loads the form field data into variables.
If you add a form field, you will need to add it here.
*/
$name = $_REQUEST['name'] ;
$mobile = $_REQUEST['mobile'] ;
$email_address = $_REQUEST['email_address'] ;
$cv = $_REQUEST['cv'] ;
$comments = $_REQUEST['comments'] ;

/*
The following function checks for email injection.
Specifically, it checks for carriage returns - typically used by spammers to inject a CC list.
*/
function isInjected($str) {
$injections = array('(\n+)',
'(\r+)',
'(\t+)',
'(%0A+)',
'(%0D+)',
'(%08+)',
'(%09+)'
);
$inject = join('|', $injections);
$inject = "/$inject/i";
if(preg_match($inject,$str)) {
return true;
}
else {
return false;
}
}

// If the user tries to access this script directly, redirect them to the feedback form,
if (!isset($_REQUEST['email_address'])) {
header( "Location: $feedback_page" );
}

// If the form fields are empty, redirect to the error page.
elseif (empty($email_address) || empty($comments)) {
header( "Location: $error_page" );
}

// If email injection is detected, redirect to the error page.
elseif ( isInjected($email_address) ) {
header( "Location: $error_page" );
}

// If we passed all previous tests, send the email then redirect to the thank you page.
else {
mail( "$webmaster_email", "Feedback Form Results",
$comments, "From: $email_address" );
header( "Location: $thankyou_page" );
}
?>
srijan.kuls is offline   Reply With Quote
Old 09-01-2013, 04:07 AM   #2
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,175
Default

Add the strings. You only have $comment being mailed
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 09-01-2013, 06:37 AM   #3
srijan.kuls
 
Join Date: Aug 2013
Posts: 4
Default

Quote:
Originally Posted by edbr View Post
Add the strings. You only have $comment being mailed
Thanks but i'm a designer and m not into that coding thing.. so it would be highly appreciable if you can make it more clear.
srijan.kuls is offline   Reply With Quote
Old 09-01-2013, 08:05 AM   #4
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,175
Default

$name = $_REQUEST['name'] ;
$mobile = $_REQUEST['mobile'] ;
$email_address = $_REQUEST['email_address'] ;
$cv = $_REQUEST['cv'] ;
$comments = $_REQUEST['comments'] ;
these are your form fields so you have to create a string opr an array, ie. $message, collecting them all, then send them. however i it looks like one is an attachment so you might need help or ad different script.
There are some tutorials on this forum and i think there maybe one that would help you
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 09-01-2013, 05:53 PM   #5
srijan.kuls
 
Join Date: Aug 2013
Posts: 4
Default

thanks a lot sir
srijan.kuls is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:13 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com