Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Auto response form

Status
Not open for further replies.

ChrisRChamberlain

Programmer
Mar 23, 2000
3,392
GB
Hi all

The following Form to E-mail script is the only CGI script of its type allowed by this particular ISP.

<html>
<head>
<title>Your title</title>
</head>
<body>

<form method=&quot;post&quot; action=&quot;
<!--The title and URL of the form will be listed at the top of the e-mail-->
<input type=&quot;hidden&quot; name=&quot;Form title&quot; value=&quot;Source of form&quot;>

<!--Specify the e-mail address to which data from the form should be sent-->
<input type=&quot;hidden&quot; name=&quot;SendMailTo&quot; value=&quot;youremailname@btinternet.com&quot;>

<!--Specify the acknowledgement page to be seen by customers who have sent in the form-->
<input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;
<h1>Form title here</h1>
<p>explanatory text here</p>

<pre>

<b>Name</b>
<input name=&quot;Name&quot;>

<b>E-mail address</b>
<input name=&quot;E-mail address&quot;>

<b>Other info</b>
<input name=&quot;Other info&quot;>

<b>Description</b>
<textarea name=&quot;Description of pages&quot; rows=5 cols=50></textarea>

<b>Radio buttons</b>
<input type=&quot;radio&quot; name=&quot;year&quot; value=&quot;1997&quot;> 1997
<input type=&quot;radio&quot; name=&quot;year&quot; value=&quot;1996&quot;> 1996
<input type=&quot;radio&quot; name=&quot;year&quot; value=&quot;1995&quot;> 1995
<input type=&quot;radio&quot; name=&quot;year&quot; value=&quot;1994&quot;> 1994

<b>Check boxes</b>

<input type=&quot;checkbox&quot; name=&quot;category&quot; value=&quot;choice A&quot;> Choice A <input type=&quot;checkbox&quot; name=&quot;category&quot; value=&quot;choice B&quot;> Choice B <input type=&quot;checkbox&quot; name=&quot;category&quot; value=&quot;choice C&quot;> Choice C <input type=&quot;checkbox&quot; name=&quot;category&quot; value=&quot;choice D&quot;> Choice D </pre>
<hr>
<center>
<input type=&quot;submit&quot; value=&quot;Submit&quot;> <input type=&quot;Reset&quot; value=&quot;Start Again&quot;>
</center>
</form>
</body>
</html>

It submits standard user entered information back to the site owner.

What I would like to do is carry the 'E-mail address.value' and any other relevant values, (use cookies?), forward to the acknowledgement page and using

<meta http-equiv=&quot;refresh&quot; content = &quot;4; URL=

or similar, run the CGI script again but this time using values that say 'Thanks for subscribing...' etc, and substituting 'SendMailTo.value' with 'E-mail address.value'.

An alternative and possibly simpler option would be to run the script twice from the first page before going to the second.

Thus you will automatically respond to a request to subscribe to a mailing list, etc.

TIA

FAQ184-2483 - the answer to getting answered.​
Chris [pc2]
 
You'll have to be able to modify the cgi script. Is this a script that they provide or one that you had to pay for?

There's always a better way. The fun is trying to find it!
 
Change this:

<form method=&quot;post&quot; action=&quot;
to:

<form method=&quot;post&quot; onSubmit=&quot;sendEmail()&quot; action=&quot;
and make a javaScript sendEmail() function. You can reference form fields in javascript to extract their values (in this case you would want the email address that the user enters).

The last line in the function should say
return true;
so that the form will then be sent to the CGI program.






Clive
 
the ISP won't allow CDONTS?

Many .asp question and answers are now in downloadable pdf format and can be found here: thread333-721855
 
Thanks to all for your responses.

The script posted is as supplied by the ISP, and has been subsequently amended with an email validation function as follows:-

</script>

<script language=&quot;JavaScript1.2&quot;>

//Advanced Email Check credit-
//By JavaScript Kit (//Over 200+ free scripts here!

var testresults
function checkemail(){
var str=document.validation.emailcheck.value
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if (filter.test(str))
testresults=true
else{
alert(&quot;Please input a valid email address!&quot;)
testresults=false
}
return (testresults)
}
</script>

<script>
function checkbae(){
if (document.layers||document.getElementById||document.all)
return checkemail()
else
return true
}
</script>

The form tag is as follows :-

<form method=&quot;post&quot; name=&quot;validation&quot; action=&quot; onsubmit=&quot;return checkbae()&quot;>

Is it not possible to use the one fuction by adding something like:-

document.location=&quot;mailto:&quot;+document.validation.emailcheck.value;
(the users email address), etc

into the checkbae() function where it returns true?

If so, how should this code read?



FAQ184-2483 - the answer to getting answered.​
Chris [pc2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top