Help - Search - Members - Calendar
Full Version: contact form
HTMLHelp Forums > Web Authoring > Markup (HTML, XHTML, XML)
deep
hi guys,
can anybody please tellme how to create a contact form. means the form should be emailed to my ymail. here is the form i created and php file(i downloaded).

QUOTE
<!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>Untitled Document</title>
</head>
<form method="post" action="send detail.php">

<!-- DO NOT change ANY of the php sections -->
<?php
$ipi = getenv("REMOTE_ADDR");
$httprefi = getenv ("HTTP_REFERER");
$httpagenti = getenv ("HTTP_USER_AGENT");
?>

<input type="hidden" name="ip" value="<?php echo $ipi ?>" />
<input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
<input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />


Your Name: <br />
<input type="text" name="visitor" size="35" />
<br />
Your Email:<br />
<input type="text" name="visitormail" size="35" />
<br /> <br />
<br />
Attention:<br />
<select name="attn" size="1">
<option value=" Sales n Billing ">Sales n Billing </option>
<option value=" General Support ">General Support </option>
<option value=" Technical Support ">Technical Support </option>
<option value=" Webmaster ">Webmaster </option>
</select>
<br /><br />
Mail Message:
<br />
<textarea name="notes" rows="4" cols="40"></textarea>
<br />
<input type="submit" value="Send Mail" />
<br />
</form>

<body>
</body>
</html>


php code

QUOTE

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sendemail Script</title>
</head>
<body>

<p>
<!-- Reminder: Add the link for the 'next page' (at the bottom) -->
<!-- Reminder: Change 'YourEmail' to Your real email -->

<?php

$ip = $_POST['ip'];
$httpref = $_POST['httpref'];
$httpagent = $_POST['httpagent'];
$visitor = $_POST['visitor'];
$visitormail = $_POST['visitormail'];
$notes = $_POST['notes'];
$attn = $_POST['attn'];


if (eregi('http:', $notes)) {
die ("Do NOT try that! ! ");
}
if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
{
echo "<h2>Use Back - Enter valid e-mail</h2>\n";
$badinput = "<h2>Feedback was NOT submitted</h2>\n";
echo $badinput;
die ("Go back! ! ");
}

if(empty($visitor) || empty($visitormail) || empty($notes )) {
echo "<h2>Use Back - fill in all fields</h2>\n";
die ("Use back! ! ");
}

$todayis = date("l, F j, Y, g:i a") ;

$attn = $attn ;
$subject = $attn;

$notes = stripcslashes($notes);

$message = " $todayis [EST] \n
Attention: $attn \n
Message: $notes \n
From: $visitor ($visitormail)\n
Additional Info : IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n
";

$from = "From: $visitormail\r\n";


mail("darli_deep2007@yahoo.com", $subject, $message, $from);

?>
</p>
<p> </p>
<p>Thank you</p>
</body>
</html>
Ghost Designs
but like i said i aint good with forms wink.gif
QUOTE
<form method="post" action="send detail.php">



i aint the best with forums, but i believe you need to change the action, make it something like . . .

<form method="post" action="mailto:youremail@yahoo.com">

but like i said i aint very good with forms
Darin McGrew
QUOTE(Ghost Designs @ Oct 11 2008, 02:40 PM) *
i aint the best with forums, but i believe you need to change the action, make it something like . . .

<form method="post" action="mailto:youremail@yahoo.com">
No, that won't help. Forms that use action="mailto:..." are unreliable. Submitting to a server-side (e.g., PHP, CGI) program is the right thing to do.

To the original poster:

What happens when you try to submit the form? Do you get any error messages?
deep
No, the browser is asking for the file download of the php script.

Deep
Darin McGrew
That sounds like your server isn't configured to use PHP. Since it doesn't know what *.php files are, it just sends them to the browser as downloadable files.
deep
so should i configure my dw site. while creating site it will ask "which server technology are you using?" i said iam not using. should i select php there?

Deep
Darin McGrew
Does your server support PHP? Is your account configured to use PHP?

There's no point configuring Dreamweaver to use a PHP server if you don't have a PHP server.
deep
so after uploading the site it will work perfect?

Deep
Darin McGrew
Are you trying to run PHP programs without a server? That won't work. Server-side programs require a server.
deep
oh, ok i will tell you whether it is working or not after uploading the site. but my host server doesn't support php. so you know any host?

Deep
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2024 Invision Power Services, Inc.