I will admit I know absolutely nothing about PHP and having tried following code example from the web am even more confused.
Basically the club I help with has changed hosting from an ASP based one to a PHP based one (cost!), without letting me know.
I wrote the web page several years ago and now need to change the ASP to PHP to allow form data to be emailed to the clubs email address. I will be changing it by adding a repeat email, so will need to amend validation to ensure the email addresses match. I suggested adding a captcha, but the club committee don't want it (yet...)
The ASP is on same page as the form (to allow alerts to be displayed). I haven't found how to do this with PHP
Can anyone give me some pointers as to the way to convert this to PHP?
Basically the club I help with has changed hosting from an ASP based one to a PHP based one (cost!), without letting me know.
I wrote the web page several years ago and now need to change the ASP to PHP to allow form data to be emailed to the clubs email address. I will be changing it by adding a repeat email, so will need to amend validation to ensure the email addresses match. I suggested adding a captcha, but the club committee don't want it (yet...)
The ASP is on same page as the form (to allow alerts to be displayed). I haven't found how to do this with PHP
Code:
<form style="margin: 25px; padding: 0px; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px;" method=Post action="">
<p class="leftNormalText">Your name</p>
<input type="text" name="t1" size="40"><br>
<p class="leftNormalText">Your email</p>
<input type="text" name="t2" size="40"><p>
<p class="leftNormalText">Enquiry type</p>
<select name="s1">
<option value="Waiting List Enquiry">Membership Enquiry - New/Waiting List</option>
<option value="Member Enquiry">Membership Enquiry - Existing Member</option>
<option value="Uniform Enquiry">Uniform Enquiry</option>
<option value="Coach Enquiry">Coaching Enquiry</option>
<option value="Other Enquiry">Other Enquiry</option>
</select>
<p class="leftNormalText">Your message</p>
<textarea rows="6" name="st" cols="80"></textarea><p>
<input type=submit value=Submit></form>
<%
if request.servervariables("REQUEST_METHOD")= "POST" then
Dim JMail, intComp, strReferer, strServer, strClientIP, strServerIP, blnSpam
Dim stname,st
Dim t1name,t1,t2name,t2, s1
Dim i
t1name = "Sender's name"
t1 = Request.Form("t1")
t2name = "Sender's email"
t2 = Request.Form("t2")
stname = "Message"
st = Request.Form("st")
s1 = Request.Form("s1")
if (len(t2) > 0) and (len(t1)>0) and (len(st)>0) Then
Set JMail = Server.CreateObject("JMail.SMTPMail")
strReferer = request.servervariables("HTTP_REFERER")
strServer = Replace(request.servervariables("SERVER_NAME"),"[URL unfurl="true"]www.","")[/URL]
strClientIP = request.servervariables("REMOTE_ADDR")
strServerIP = request.servervariables("LOCAL_ADDR")
intComp = inStr(strReferer, strServer)
If intComp > 0 Then
blnSpam = False
Else
' Spam Attempt Block
blnSpam = True
End If
JMail.ServerAddress = "smtp." & strServer & ":25"
JMail.AddRecipient "info@oursportsclub.org.uk"
JMail.Sender = "info@oursportsclub.org.uk"
JMail.Subject = s1 & " From Website"
JMail.Body = t1name & vbcrlf&_
t1 & vbcrlf&_
t2name & vbcrlf&_
t2 & vbcrlf&_
stname & vbcrlf&_
st & vbcrlf&_
now()
if NOT blnSpam Then
JMail.Execute
strResult = "Mail Sent."
Response.Write("<" & "script language=""javascript"">")
Response.Write("alert(""" & strResult & """);<" & "/script>")
Else
strResult = "Mail Could Not Be Sent."
Response.Write("<" & "script language=""javascript"">")
Response.Write("alert(""" & strResult & """);<" & "/script>")
End If
Set JMail = Nothing
Else
strResult = "Please Ensure All Fields Are Completed"
Response.Write("<" & "script language=""javascript"">")
Response.Write("alert(""" & strResult & """);<" & "/script>")
End If
End If
%>
Can anyone give me some pointers as to the way to convert this to PHP?