Ok .. I am very just a newbie .. and not a programmer... trying to learn php .. but want to as soon as possible to make my first contact form on my site. So after going through various tutorials .. and feeling stupid.. .event though I like learning .. but time is rushing me a bit.. so... I found good script .. that i thought I can change a bit to suit me... Most of the feautures works but...entered name does not show in thank you line.. no idea what I have missed. Can anyone just at least look at this... also it seems like it is not supported by netscape 6🙁
subject and email are ok.. showing in right places.. but I want enered name shows after thank you.. and i thought it will be simple ..but darn.. I have messed that totally
Here is the script for input
<script language="javascript" type="text/javascript">
function stoperror(){
return true
}
window.onerror=stoperror
</script>
<script language="javascript" type="text/javascript">
function placeFocus() {
if (document.forms.length > 0) {
var field = document.forms[0];
for (i = 0; i < field.length; i++) {
if ((field.elements.type == "text") || (field.elements.type == "textarea") || (field.elements.type.toString().charAt(0) == "s")) {
document.forms[0].elements.focus();
break;
}
}
}
}
</script>
</head>
<body onLoad="document.emailform.text.focus();placeFocus()">
<center>
<h1 class="style1"><span class="style5">mywebname</span></h1>
<p class="style1"><span class="style7">CONTACT US </span><br>
Call, Email or Stop By! </p>
<p class="style1"> </p>
<table cellspacing="0" cellpadding="0">
<tr>
<td> </td>
<td class="bandTitle"><p align="center">mine address1, <br>
mine address </p>
<p align="center"> </p></td>
</tr>
<tr>
<td width="7%"><img src="1dot_red.gif" alt="dot" width="16" height="16"></td>
<td class="bandTitle" width="93%">Phone </td>
</tr>
<tr>
<td></td>
<td>mine phone number</td>
</tr>
<tr>
<td><img src="1dot_blue.gif" alt="dot" width="16" height="16"></td>
<td class="bandTitle">Email </td>
</tr>
<tr>
<td></td>
<td><a href="mailto:me.net">info@me.net</a></td>
</tr>
</table>
<p class="style1"> </p>
<p class="style1"> </p>
<p class="style1 style8"><strong> Contact and Support Form </strong></p>
<table width="487" border="0">
<tr>
<td width="481"><p align="center" class="style1 style8"><span class="style9">Include your full name and reply e-mail to submit a form. </span></p>
<p class="style1 style8"><span class="style9">We will usually reply within 2 - 24 hrs. Thank you! </span><br>
</p></td>
</tr>
</table>
<p class="style8 style1"> </p>
<p>
<span style="color:red;font-weight:bold;"><span class="style6"></span><span style="color:red;font-weight:bold;"><?php echo $error ?></span></span> <br>
<FORM name=emailform onsubmit="return emailCheck(this.email.value);" ACTION="feedback1.php" METHOD="POST">
<table class="table" border=0>
<tr>
<td><span class="style1">Your Name: </span></td>
<td><label>
<INPUT ="TEXT" SIZE="28" NAME="name" ">
</label></td>
</tr>
<tr><td>
<label for="email"><span class="style1">Your email address</span>:</label>
</td>
<td>
<INPUT class="table" TYPE="TEXT" SIZE="28" NAME="email" value="<? echo $email; ?>" title=" YOUR email address ">
</td></tr>
<tr><td>
<label for "sub"><span class="style1">Subject:</span></label>
</td>
<td><input class="table" type="TEXT" size="28" name="sub" value="<? echo $email; ?>" title=" Enter a subject "></td></tr>
<tr><td colspan=2>
<p align="center">
<label for "text"></label>
<label for "text"><span class="style1">Message:</span></label>
</p>
<div align="center">Fill In Any Additional Information Or Questions Below: <br>
<textarea class="table" rows="8" cols="50" wrap="virtual" name="text" onKeyUp=" val = this.value; if (val.length > 800) { alert('Sorry, you are over the limit of 800 characters'); this.value = val.substring(0,800); emailform.focus() } this.form.count.value=800-parseInt(this.value.length); "><? echo $text; ?>
</textarea>
<br>
<input type="text" class="counter" name="count" value="800" size="2" onFocus="this.blur" readonly>
characters available
<?php $text_len = preg_match_all('/./', $str, $dummy); ?>
</div></td></tr>
<tr>
<td align=center colspan=2>
<INPUT TYPE="SUBMIT" VALUE=" Send email " name="Demo" title=" Click once and wait for confirmation screen " class="feedbutton"feedbutton" onmouseover="this.className='feedbutton1'" onmouseout="this.className='feedbutton'" onClick="CallJS('Demo()')"> <noscript>
<span class="style1"><b>Click and wait for confirmation page</b></span>
</noscript>
</td></tr>
</table>
<?
function title($filename) {
$open=fopen("$filename","r");
while(!feof($open)) {
$line=fgets($open,255);
$string = $line;
while(ereg( '<title>([<])</title>(.)', $string, $regs ) ) {
$string = $regs[2];
}
}
return $regs[1];
}
if(isset($SERVER['HTTP_REFERER'])) {
$file = $SERVER['HTTP_REFERER'];
$title = title($file);
} else {
$title = "There was no referring page.";
}
?>
<INPUT TYPE="HIDDEN" NAME="title" VALUE="<?php print "$title"; ?> <? echo $id;?>">
</form>
<script language="JavaScript" src="progressbar.js" type=text/javascript>
</script>
<script language="javascript" type="text/javascript">
document.write("<span id=\"progress\" class=\"hide\">");
document.write("<FORM name=dialog>");
document.write("<TABLE border=0 bgcolor=\"#9F141A\">");
document.write("<TR><TD ALIGN=\"center\">");
document.write("<span style=\"color:white;font-size:70%;\">Please wait</span><BR>");
document.write("<input type=text style=\"border:solid;border-color:#9F141A;border-width:1px;\"name=\"bar\" size=\"" + _progressWidth/2 + "\"");
if(document.all||document.getElementById) // Microsoft, NS6
document.write(" bar.style=\"color:navy;\">");
else // Netscape
document.write(">");
document.write("</TD></TR>");
document.write("</TABLE>");
document.write("</FORM>");
document.write("</span>");
ProgressDestroy(); // Hides
-->
</script>
</center>
<blockquote>
<p>
<ul>
<script type="text/javascript" language="javascript">
<!--
document.write('<li><a href=\"javascript:history.go(-1);\">Previous page</a>');
//-->
</script>
<noscript><li>Use your browser back button to return to previous page
</noscript>
</ul>
</blockquote>
<script language="JavaScript" src="validator.js" type=text/javascript>
</script>
</body>
</html>
And output tha i would like to show..
<body>
<?php
$headers = "From: $email";
$message .= "
From: $title
____________________________________
$text
";
$message2 .= "
Thank you for your email message regarding the subject: $sub.\n
We will respond to it as quickly as we can. If you do not hear from us within two days, please feel
free to write again! For your reference, the text of your message is added at the end of this email.\n
Cheers,\n
myweb
www.me.net\n
Your original message was
$text
";
$headers2 .= "From: me.net\n";
$sub2.="Re: $sub";
?>
"<h1>Thank you! <? $_POST[name];?> </h1>
<p>Your message has been sent. You gave your email address as<p>
<nobr><span style="color:red;font-size:150%;font-weight:bold;"><?php print $email; ?></span></nobr>
<p>If not correct, please
<script language='javascript' type='text/javascript'>
document.write('<a href="javascript:history.go(-1);">go back</a>');
</script>
<noscript>go back</noscript>
and send again.
<p>
<script language='javascript' type='text/javascript'>
document.write('<li><a href="javascript:history.go(-2);">Return to Your Site Name</a>');
</script>
<script language='javascript' type='text/javascript'>
setTimeout('history.go(-2)', 9000);
</script>
<noscript>
<li>Click your 'back button' twice to return to main page
</noscript>
<?php
$message = stripslashes($message);
$message2 = stripslashes($message2);
$message = strip_tags ($message);
$message2 = strip_tags ($message2);
mail("", $sub, $message, $headers);
mail($email, $sub2, $message2, $headers2);
?>
</body>
</html>