PDA

View Full Version : Form Submit 2 methods?


garybrett
03-20-2009, 12:07 PM
Hi I have created a form using the "record insertion form wizard" in Dreamweaver MX. This posts the form data to my SQL table which is great but I also would like it to fire an email with the data inside, is it possible to have 2 actions on submit? Currently DW has <input type="submit" value="Insert record"> only on the submite button?

Thanx

Corrosive
03-20-2009, 01:47 PM
Hi I have created a form using the "record insertion form wizard" in Dreamweaver MX. This posts the form data to my SQL table which is great but I also would like it to fire an email with the data inside, is it possible to have 2 actions on submit? Currently DW has <input type="submit" value="Insert record"> only on the submite button?

Thanx

You can have as many actions as you want on a submit. You'd be better learning a bit of PHP yourself rather than relying on DW code.

garybrett
03-20-2009, 01:50 PM
Hi,
Sorry may have misled you there I am using SQL2005 not mysql so not using php at all? I am sure there must eb a method to insert data and email.. tThis is the submit code:

<input type="submit" value="Insert record">
</td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1">
</form>

Thanx again..

Corrosive
03-20-2009, 01:58 PM
Hi,
Sorry may have misled you there I am using SQL2005 not mysql so not using php at all? I am sure there must eb a method to insert data and email.. tThis is the submit code:

<input type="submit" value="Insert record">
</td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1">
</form>

Thanx again..

Ah, sorry mate. That's the Microsoft SQL. No idea I'm afraid :(

garybrett
03-20-2009, 04:14 PM
Hi again,
I have just tried a test to send mail as a starter from server using folowing but it falls over at first line <%? any ideas? Its a 2003 server with cdosys.dll installed?

<%
'----------------------------------------------------------------------------
'
' Send email using the CDOSYS component
'
' by Chris Hardy
' http://www.chrishardy.co.uk/
'
'----------------------------------------------------------------------------
Option Explicit
dim sName, sEmail, sMessage
dim oCdoMail, oCdoConf, sConfURL
if Request.Form("Action") <> "" then
sName = Request.Form("Name")
sEmail = Request.Form("Email")
sMessage = Request.Form("Message")
Set oCdoMail = Server.CreateObject("CDO.Message")
Set oCdoConf = Server.CreateObject("CDO.Configuration")
sConfURL = "http://schemas.microsoft.com/cdo/configuration/"
with oCdoConf
.Fields.Item(sConfURL & "sendusing") = 2
.Fields.Item(sConfURL & "smtpserver") = "localhost"
.Fields.Item(sConfURL & "smtpserverport") = 25
.Fields.Update
end with
with oCdoMail
.From = "you@yourdomain.com"
.To = sEmail
.Subject = "My message subject"
.TextBody = sMessage
.HTMLBody = sMessage
.Configuration = oCdoConf
.Send
end with
Set oCdoConf = Nothing
Set oCdoMail = Nothing
response.write "Thanks for your message!"
else
%>
<form method="post" action="<%=Request.ServerVariables("SCRIPT_NAME")%>">
<p>Name:<br /><input type="text" name="Name" /></p>
<p>E-mail:<br /><input type="text" name="Email" /></p>
<p>Message:<br /><textarea name="Message"></textarea></p>
<p><input type="submit" name="Action" value="Send" /></p>
</form>
<%
end if
%>

davidj
03-20-2009, 04:39 PM
what happens when you type http://localhost in your browser

garybrett
03-20-2009, 04:49 PM
Hi David,
It returns Bad Request (Invalid Hostname), but I guess thats because I have many IIS sites configured on here. If I type http:\\192.168.168.20 it loads my site fine?

Jut to add I followed a tutorial [attached] to add the email function inside the "Record Insertion Form Wizard" but again this falles over, maybe becuase it uses CDONTs on a 2003 server? here is the code I have used if its OK?

Heres the error:

Microsoft JScript compilation error '800a03ec'
Expected ';'
/Copy of recruitreg.asp, line 86 Set objCDO = Server.CreateObject("Cdonts.NewMail")----^

My code is attached in txt file?

Thanx again

davidj
03-20-2009, 05:09 PM
im sorry

im just trying to troubleshoot the obvious

im not an ASP programmer so am unable to help further

mjoyce71
03-22-2009, 05:12 PM
If you don't want to learn the database and PHP code use these guys:

www.formmailhosting.com (http://www.formmailhosting.com)

They will do the form to email part and stored the results as a CSV (MS Excel) file.

Hope this helps.

Mark