PHP form not sending to email problem
- sthebest
- Born


- Joined: Apr 02, 2008
- Posts: 3
- Status: Offline
hi all. im trying to code a simple form for people to fll out if they are interested in booking a reservation (its a site for a Charter Boat site). here is what the code for the form looks like:
Can anyone tell me why it is not sending the results of the form to an email address? Your help would be much appreciated!
HTML Code: [ Select ]
<form action="gdform.asp" method="post">
<input type="hidden" name="subject" value="Form Submission" />
<input type="hidden" name="redirect" value="thanks.html" />
<input type="hidden" name="email" value="email address goes here" />
<p style="font-weight:bold;font-family:sans-serif;">Thank you for your interest in booking a reservation with KO Charters. We appreciate your patronage. Please
fill out the form below and a representative will get back to you as soon as possible.</p>
<p style="font-family:sans-serif;font-size:12px;">Email: <input type="TEXT" name="email"><br/>
<p style="font-family:sans-serif;font-size:12px;">First Name: <input type="TEXT" name="Firstname"><br/>
<p style="font-family:sans-serif;font-size:12px;">Last Name: <input type="TEXT" name="Lastname"><br/>
<p style="font-family:sans-serif;font-size:12px;">Address: <input type="TEXT" name="address"><br/>
<p style="font-family:sans-serif;font-size:12px;">City: <input type="TEXT" name="b.city"><br/>
<p style="font-family:sans-serif;font-size:12px;">State: <input type="TEXT" name="c.state"><br/>
<p style="font-family:sans-serif;font-size:12px;">Zip Code: <input type="TEXT" name="c.zip"><br/>
<p style="font-family:sans-serif;font-size:12px;">Telephone: <input type="TEXT" name="phone"><br/>
<p style="font-family:sans-serif;font-size:12px;">Number of Passengers: <input type="TEXT" name="no.passengers"><br/>
<p style="font-family:sans-serif;font-size:12px;">Charter Date: <input type="TEXT" name="date"><br/>
<p style="font-family:sans-serif;font-size:12px;">Desired Package: <input type="TEXT" name="package"><br/>
<p style="font-family:sans-serif;font-size:12px;">Desired Extras: <input type="TEXT" name="extras"><br/>
<p style="font-size:9px;color:red;font-family:sans-serif;">*Your information will be kept confidential with KO Charters and
will never be sold or shared by third parties.</p>
<input type="submit" name="submit" value="submit"/>
<input type="hidden" name="subject" value="Form Submission" />
<input type="hidden" name="redirect" value="thanks.html" />
<input type="hidden" name="email" value="email address goes here" />
<p style="font-weight:bold;font-family:sans-serif;">Thank you for your interest in booking a reservation with KO Charters. We appreciate your patronage. Please
fill out the form below and a representative will get back to you as soon as possible.</p>
<p style="font-family:sans-serif;font-size:12px;">Email: <input type="TEXT" name="email"><br/>
<p style="font-family:sans-serif;font-size:12px;">First Name: <input type="TEXT" name="Firstname"><br/>
<p style="font-family:sans-serif;font-size:12px;">Last Name: <input type="TEXT" name="Lastname"><br/>
<p style="font-family:sans-serif;font-size:12px;">Address: <input type="TEXT" name="address"><br/>
<p style="font-family:sans-serif;font-size:12px;">City: <input type="TEXT" name="b.city"><br/>
<p style="font-family:sans-serif;font-size:12px;">State: <input type="TEXT" name="c.state"><br/>
<p style="font-family:sans-serif;font-size:12px;">Zip Code: <input type="TEXT" name="c.zip"><br/>
<p style="font-family:sans-serif;font-size:12px;">Telephone: <input type="TEXT" name="phone"><br/>
<p style="font-family:sans-serif;font-size:12px;">Number of Passengers: <input type="TEXT" name="no.passengers"><br/>
<p style="font-family:sans-serif;font-size:12px;">Charter Date: <input type="TEXT" name="date"><br/>
<p style="font-family:sans-serif;font-size:12px;">Desired Package: <input type="TEXT" name="package"><br/>
<p style="font-family:sans-serif;font-size:12px;">Desired Extras: <input type="TEXT" name="extras"><br/>
<p style="font-size:9px;color:red;font-family:sans-serif;">*Your information will be kept confidential with KO Charters and
will never be sold or shared by third parties.</p>
<input type="submit" name="submit" value="submit"/>
- <form action="gdform.asp" method="post">
- <input type="hidden" name="subject" value="Form Submission" />
- <input type="hidden" name="redirect" value="thanks.html" />
- <input type="hidden" name="email" value="email address goes here" />
- <p style="font-weight:bold;font-family:sans-serif;">Thank you for your interest in booking a reservation with KO Charters. We appreciate your patronage. Please
- fill out the form below and a representative will get back to you as soon as possible.</p>
- <p style="font-family:sans-serif;font-size:12px;">Email: <input type="TEXT" name="email"><br/>
- <p style="font-family:sans-serif;font-size:12px;">First Name: <input type="TEXT" name="Firstname"><br/>
- <p style="font-family:sans-serif;font-size:12px;">Last Name: <input type="TEXT" name="Lastname"><br/>
- <p style="font-family:sans-serif;font-size:12px;">Address: <input type="TEXT" name="address"><br/>
- <p style="font-family:sans-serif;font-size:12px;">City: <input type="TEXT" name="b.city"><br/>
- <p style="font-family:sans-serif;font-size:12px;">State: <input type="TEXT" name="c.state"><br/>
- <p style="font-family:sans-serif;font-size:12px;">Zip Code: <input type="TEXT" name="c.zip"><br/>
- <p style="font-family:sans-serif;font-size:12px;">Telephone: <input type="TEXT" name="phone"><br/>
- <p style="font-family:sans-serif;font-size:12px;">Number of Passengers: <input type="TEXT" name="no.passengers"><br/>
- <p style="font-family:sans-serif;font-size:12px;">Charter Date: <input type="TEXT" name="date"><br/>
- <p style="font-family:sans-serif;font-size:12px;">Desired Package: <input type="TEXT" name="package"><br/>
- <p style="font-family:sans-serif;font-size:12px;">Desired Extras: <input type="TEXT" name="extras"><br/>
- <p style="font-size:9px;color:red;font-family:sans-serif;">*Your information will be kept confidential with KO Charters and
- will never be sold or shared by third parties.</p>
- <input type="submit" name="submit" value="submit"/>
Can anyone tell me why it is not sending the results of the form to an email address? Your help would be much appreciated!
- Anonymous
- Bot


- Joined: 25 Feb 2008
- Posts: ?
- Loc: Ozzuland
- Status: Online
February 10th, 2010, 2:42 pm
- ATNO/TW
- Super Moderator


- Joined: May 28, 2003
- Posts: 23404
- Loc: Woodbridge VA
- Status: Offline
Well the subject of your post says "PHP form not sending to email problem" but your action in your form is sending it to an ASP script "<form action="gdform.asp" method="post">"
Which is it? php or asp?, and what is your asp/php script code?
Which is it? php or asp?, and what is your asp/php script code?
"There's no place like 127.0.0.1 except for ::1."
Alexandria Networks. Leader in IT consulting for associations/non-profits, and small to medium sized businesses around the northern Virginia and Washington D.C. metro area.
Alexandria Networks. Leader in IT consulting for associations/non-profits, and small to medium sized businesses around the northern Virginia and Washington D.C. metro area.
- sthebest
- Born


- Joined: Apr 02, 2008
- Posts: 3
- Status: Offline
Well the page itself is a PHP document, but Im using a ASP form to send the results to an email address. should I change the code to send to a PHP instead (and in turn place the php script on the server)?
Here is the ASP script code:
Forgive me for asking so many questions but Im a graphic designer by nature who coincidentally happens to do a little web design.
Here is the ASP script code:
ASP Code: [ Select ]
<%
Dim landing_page, host_url
Dim fso, outfile, filename, dirname, myFolder
Dim req_method, key, value
Dim bErr, errStr, bEmpty
On Error resume next
bErr = false
bEmpty = true
errStr = ""
Set fso = Server.CreateObject("Scripting.FileSystemObject")
host_url = Request.ServerVariables("HTTP_HOST")
req_method = Request.ServerVariables("REQUEST_METHOD")
dtNow = Now()
filename = Server.MapPath("\ssfm")
dirname = filename
filename = filename & "\gdform_" & DatePart("M", dtNow) & DatePart("D", dtNow) & DatePart("YYYY", dtNow) & DatePart("N", dtNow) & DatePart("S", dtNow)
Function FormatVariableLine(byval var_name, byVal var_value)
Dim tmpStr
tmpStr = tmpStr & "<GDFORM_VARIABLE NAME=" & var_name & " START>" & vbCRLF
tmpStr = tmpStr & var_value & vbCRLF
tmpStr = tmpStr & "<GDFORM_VARIABLE NAME=" & var_name & " END>"
FormatVariableLine = tmpStr
end function
Sub OutputLine(byVal line)
outfile.WriteLine(line)
end sub
if err.number = 0 then
Set outfile = fso.CreateTextFile(filename, true, false)
if err.number <> 0 then
bErr = true
errStr = "Error creating file! Directory may not be writable or may not exist.<br>Unable to process request."
else
if(req_method = "GET") then
for each Item in request.QueryString
if item <> "" then
bEmpty = false
key = item
value = Request.QueryString(item)
if(lcase(key) = "redirect") then
landing_page = value
else
line = FormatVariableLine(key, value)
Call OutputLine(line)
end if
end if
next
elseif (req_method = "POST") then
for each Item in request.form
if item <> "" then
bEmpty = false
key = item
value = Request.form(item)
if(lcase(key) = "redirect") then
landing_page = value
else
line = FormatVariableLine(key, value)
Call OutputLine(line)
end if
end if
next
end if
outfile.close
end if
if(bEmpty = true) AND errStr = "" then
bErr = true
errStr = errStr & "<br>No variables sent to form! Unable to process request."
end if
if(bErr = false) then
if (landing_page <> "") then
response.Redirect "http://" & host_url & "/" & landing_page
else
response.Redirect "http://" & host_url
end if
else
Response.Write errStr
end if
set fso = nothing
else
Response.Write " An Error Occurred creating mail message. Unable to process form request at this time."
end if
%>
Dim landing_page, host_url
Dim fso, outfile, filename, dirname, myFolder
Dim req_method, key, value
Dim bErr, errStr, bEmpty
On Error resume next
bErr = false
bEmpty = true
errStr = ""
Set fso = Server.CreateObject("Scripting.FileSystemObject")
host_url = Request.ServerVariables("HTTP_HOST")
req_method = Request.ServerVariables("REQUEST_METHOD")
dtNow = Now()
filename = Server.MapPath("\ssfm")
dirname = filename
filename = filename & "\gdform_" & DatePart("M", dtNow) & DatePart("D", dtNow) & DatePart("YYYY", dtNow) & DatePart("N", dtNow) & DatePart("S", dtNow)
Function FormatVariableLine(byval var_name, byVal var_value)
Dim tmpStr
tmpStr = tmpStr & "<GDFORM_VARIABLE NAME=" & var_name & " START>" & vbCRLF
tmpStr = tmpStr & var_value & vbCRLF
tmpStr = tmpStr & "<GDFORM_VARIABLE NAME=" & var_name & " END>"
FormatVariableLine = tmpStr
end function
Sub OutputLine(byVal line)
outfile.WriteLine(line)
end sub
if err.number = 0 then
Set outfile = fso.CreateTextFile(filename, true, false)
if err.number <> 0 then
bErr = true
errStr = "Error creating file! Directory may not be writable or may not exist.<br>Unable to process request."
else
if(req_method = "GET") then
for each Item in request.QueryString
if item <> "" then
bEmpty = false
key = item
value = Request.QueryString(item)
if(lcase(key) = "redirect") then
landing_page = value
else
line = FormatVariableLine(key, value)
Call OutputLine(line)
end if
end if
next
elseif (req_method = "POST") then
for each Item in request.form
if item <> "" then
bEmpty = false
key = item
value = Request.form(item)
if(lcase(key) = "redirect") then
landing_page = value
else
line = FormatVariableLine(key, value)
Call OutputLine(line)
end if
end if
next
end if
outfile.close
end if
if(bEmpty = true) AND errStr = "" then
bErr = true
errStr = errStr & "<br>No variables sent to form! Unable to process request."
end if
if(bErr = false) then
if (landing_page <> "") then
response.Redirect "http://" & host_url & "/" & landing_page
else
response.Redirect "http://" & host_url
end if
else
Response.Write errStr
end if
set fso = nothing
else
Response.Write " An Error Occurred creating mail message. Unable to process form request at this time."
end if
%>
- <%
- Dim landing_page, host_url
- Dim fso, outfile, filename, dirname, myFolder
- Dim req_method, key, value
- Dim bErr, errStr, bEmpty
- On Error resume next
- bErr = false
- bEmpty = true
- errStr = ""
- Set fso = Server.CreateObject("Scripting.FileSystemObject")
- host_url = Request.ServerVariables("HTTP_HOST")
- req_method = Request.ServerVariables("REQUEST_METHOD")
- dtNow = Now()
- filename = Server.MapPath("\ssfm")
- dirname = filename
- filename = filename & "\gdform_" & DatePart("M", dtNow) & DatePart("D", dtNow) & DatePart("YYYY", dtNow) & DatePart("N", dtNow) & DatePart("S", dtNow)
- Function FormatVariableLine(byval var_name, byVal var_value)
- Dim tmpStr
- tmpStr = tmpStr & "<GDFORM_VARIABLE NAME=" & var_name & " START>" & vbCRLF
- tmpStr = tmpStr & var_value & vbCRLF
- tmpStr = tmpStr & "<GDFORM_VARIABLE NAME=" & var_name & " END>"
- FormatVariableLine = tmpStr
- end function
- Sub OutputLine(byVal line)
- outfile.WriteLine(line)
- end sub
- if err.number = 0 then
- Set outfile = fso.CreateTextFile(filename, true, false)
- if err.number <> 0 then
- bErr = true
- errStr = "Error creating file! Directory may not be writable or may not exist.<br>Unable to process request."
- else
- if(req_method = "GET") then
- for each Item in request.QueryString
- if item <> "" then
- bEmpty = false
- key = item
- value = Request.QueryString(item)
- if(lcase(key) = "redirect") then
- landing_page = value
- else
- line = FormatVariableLine(key, value)
- Call OutputLine(line)
- end if
- end if
- next
- elseif (req_method = "POST") then
- for each Item in request.form
- if item <> "" then
- bEmpty = false
- key = item
- value = Request.form(item)
- if(lcase(key) = "redirect") then
- landing_page = value
- else
- line = FormatVariableLine(key, value)
- Call OutputLine(line)
- end if
- end if
- next
- end if
- outfile.close
- end if
- if(bEmpty = true) AND errStr = "" then
- bErr = true
- errStr = errStr & "<br>No variables sent to form! Unable to process request."
- end if
- if(bErr = false) then
- if (landing_page <> "") then
- response.Redirect "http://" & host_url & "/" & landing_page
- else
- response.Redirect "http://" & host_url
- end if
- else
- Response.Write errStr
- end if
- set fso = nothing
- else
- Response.Write " An Error Occurred creating mail message. Unable to process form request at this time."
- end if
- %>
Forgive me for asking so many questions but Im a graphic designer by nature who coincidentally happens to do a little web design.
Page 1 of 1
To Reply to this topic you need to LOGIN or REGISTER. It is free.
Post Information
- Total Posts in this topic: 3 posts
- Users browsing this forum: No registered users and 166 guests
- You cannot post new topics in this forum
- You cannot reply to topics in this forum
- You cannot edit your posts in this forum
- You cannot delete your posts in this forum
- You cannot post attachments in this forum
