PDA

View Full Version : feedback form doesnt work


matiss
05-02-2006, 12:54 AM
hi, i ve created form with help of tutor.¨Using Dreamweaver and PHP to send form results in an email¨ but it doesnt work. I ve laced my php.file in the same directory as index.html , but always got the message that the file was not found on the server. (check out www.edesign.sk). Im absolutely Newbie to DW so plz could somebody help me. :?

davidj
05-02-2006, 08:30 AM
please post code from page that calls in your php file

matiss
05-03-2006, 10:55 PM
heres the 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=iso-8859-1" />
<title>Contact Form</title>
<style type="text/css">
<!--
@import url("file:///C|/Documents and Settings/Matiss Fufu/My Documents/form.css");
.button {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
color: #CC3333;
text-decoration: none;
border: medium groove #CC3333;
}
.input_text {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
color: #FFFFFF;
text-decoration: none;
background-color: #990000;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-top-color: #000000;
border-right-color: #999999;
border-bottom-color: #999999;
border-left-color: #000000;
}
-->
</style>
<script type="text/JavaScript">
<!--
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++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_valida teForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
}
//-->
</script>
</head>

<body>
<form id="contact form" name="contact form" method="post" action="send_result.php">
<table width="374" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2">Contact Form </td>
</tr>
<tr>
<td width="140">Name</td>
<td width="234"><label>
<input name="textfield" type="text" class="button" onblur="MM_validateForm('textfield','','R');return document.MM_returnValue" size="30" />
</label></td>
</tr>
<tr>
<td>E-mail</td>
<td><label>
<input name="textfield2" type="text" class="button" onblur="MM_validateForm('textfield2','','RisEmail');return document.MM_returnValue" size="30" />
</label></td>
</tr>
<tr>
<td valign="top">Comments</td>
<td><label>
<textarea name="textarea" cols="35" rows="4" class="input_text">

whats wrong ?? :O?

matiss
05-03-2006, 11:07 PM
..and heres my php file
<!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=iso-8859-1" />
<title>send_result</title>
</head>

<body>
<?php
$subject = 'Result from contact form';
$emailadd = 'edesign@edesign.sk';
$url = 'http>://www.edesign.sk/thankx.html';
$req = '0';
$text = 'Result from:\n\n';
$space = ' ';
$line = ' ';
foreach($_POST as $key => $value)
{
if ($req == '1')
{
if ($value =='')
{ echo"$key is empty";die;}
}
$j = strlen ($key);
if ($j>=20)
{ echo "Name of form element $key cannot be longer than 20 character";die;}
$j=20-$j;
for ($i=1; $i<=$j; $i++)
{ $space.=' ';}
$value = str_replace('\n',"$line",$value);
$conc = "{$key}:.$space{$value}$line";
$text.= '';
}
mail($mailadd,$subject,$text,$'From:'.$emailadd.'' );
echo'<META HTTP-EQUIV=Refresh CONTENT="0;URL='.$url.'">';
?>
</body>

matiss
05-05-2006, 10:49 PM
i edited one php script little and now it works..could U sey me why?? whats wrong with the first one.. it is safe this i use know?? I hope U understand my bad english :O).. Im happy it works but I wanna understand how and why..if U have a minute...thankx
php I use now for the form looks like this..quite simple..and short :?

<?php
$to='edesign@edesign.sk';
$body='';
$headers="Content-Type: text/plain;
charset=UTF-8\nFrom: edesign@edesign.sk";
foreach ($_POST as $k=>$v) {
$body.="$k: $v\n\n";
}mail($to,'kontaktny formular',$body,$headers);
header('Location: /thankx.html');
?>