Help!

kareemamir

New Member
Hey all. Im hoping to get some help. I have a contact form that I would like to change, but I have no idea how to! You can view the current form here.

I would like to add a new field. I want the user to input a password and get it sent with the other fields.

I dont know if it can be done so any help would be helpful. thanks very much.

HTML:
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
<style type="text/css">
.style1 {
	color: #FFF0E6;
}
</style>
</head>
<div align="center">
<font face="Trebuchet MS" size="3" color="#FF0000"><b>Ask Death Note</b></font><p>
<font face="Trebuchet MS" size="3">Have you got something to say about Death 
Note. Do you have any questions you need answer. Are you looking for something 
on the internet and need help locating it? Well whatever you need just let me 
know and ill help ya!</font></p>
<p><font face="Trebuchet MS" size="3">All questions asked will have a reply 
within 24 hours!</font></p>

<form action="feedback.php" method="post">
<table border="1" cellpadding="8" cellspacing="8" summary="feedback form" width="428">
<tr><td width="124"><b><font face="Trebuchet MS">Name:</font></b></td>
	<td width="248">
	<input type="text" name="name" size="40" style="font-family: Trebuchet MS" /></td></tr>
<tr><td width="124"><font face="Trebuchet MS"><b>Email Address:</b></font></td>
	<td width="248">
	<input type="text" name="email" size="40" style="font-family: Trebuchet MS" /></td></tr>
<tr>
<td colspan="2" height="153">
<p align="center">
<b><font face="Trebuchet MS">Comment / Question</font></b><br />
<textarea rows="6" cols="61" name="comments" style="font-family: Trebuchet MS"></textarea>
</td>
</tr>
<tr>
<td align="center" colspan="2" height="44">
<input type="submit" value="Send Feedback" /><br />
</td>
</tr>
</table>
</form>
</div>

PHP:
<?
// ------------- CONFIGURABLE SECTION ------------------------

// $mailto - set to the email address you want the form
// sent to, eg
//$mailto		= "[email protected]" ;

$mailto = '[email protected]' ;

// $subject - set to the Subject line of the email, eg
//$subject	= "Feedback Form" ;

$subject = "Feedback - Death Note" ;

// the pages to be displayed, eg
//$formurl		= "http://www.example.com/feedback.html" ;
//$errorurl		= "http://www.example.com/error.html" ;
//$thankyouurl	= "http://www.example.com/thankyou.html" ;

$formurl = "http://www.death-note.co.uk/feedback.html" ;
$errorurl = "http://www.death-note.co.uk/feedback-error.html" ;
$thankyouurl = "http://www.death-note.co.uk/feedback-thankyou.html" ;

$uself = 0;

// -------------------- END OF CONFIGURABLE SECTION ---------------

$headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;
$name = $_POST['name'] ;
$email = $_POST['email'] ;
$comments = $_POST['comments'] ;
$http_referrer = getenv( "HTTP_REFERER" );

if (!isset($_POST['email'])) {
	header( "Location: $formurl" );
	exit ;
}
if (empty($name) || empty($email) || empty($comments)) {
   header( "Location: $errorurl" );
   exit ;
}
if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) {
	header( "Location: $errorurl" );
	exit ;
}

if (get_magic_quotes_gpc()) {
	$comments = stripslashes( $comments );
}

$messageproper =

	"This message was sent from:\n" .
	"$http_referrer\n" .
	"------------------------------------------------------------\n" .
	"Name of sender: $name\n" .
	"Email of sender: $email\n" .
	"------------------------- COMMENTS / QUESTIONS -------------------------\n\n" .
	$comments .
	"\n\n------------------------------------------------------------\n" ;

mail($mailto, $subject, $messageproper,
	"From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.07" );
header( "Location: $thankyouurl" );
exit ;

?>
 

ISDProductions

New Member
use this code to add the password feild to your form

<input type="password" name="pass" size="40" style="font-family: Trebuchet MS" />

Now add this to your PHP code

right below the line that reads:

$comments = $_POST['comments'] ;

add

$pass = $_POST['pass'] ;


then change this code to :
Code:
$messageproper = 

    "This message was sent from:\n" . 
    "$http_referrer\n" . 
    "------------------------------------------------------------\n" . 
    "Name of sender: $name\n" . 
    "Email of sender: $email\n" . 
   "Password of sender: $pass\n" .
    "------------------------- COMMENTS / QUESTIONS -------------------------\n\n" . 
    $comments . 
    
    "\n\n------------------------------------------------------------\n" ;

That should do it
 
Top