| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
Need help to create a code for Newsletter subscriptions
Hi
I need assistance to create a asp page to allow user to enter their email address and subscribe to monthly newsletter. I need the code to be automatically updating a database and also allow auto removing of entries. Can anyone provide any assistance? thank you |
|
#2
|
|||
|
|||
|
Basically what you want is a simple form:
<form action="postform.asp"> Email Address: <input type="text" name="email" size="20"> Subscribe <input type="radio" name="subval" value="On"> Unsubscribe <input type="radio" name="subval" value="Off"> <input type="submit" value="Go"> </form> Then on page postform.asp: Email = request("Email") Email = replace(Email, "'", "''") <---- This piece is important so users can't trash the db. SubVal = request("Subval") if SubVal = "On" then recordset.open "INSERT INTO subscriptiontable (email) VALUES ('" & Email & "')" end if if SubVal = "Off" then recordset.open "DELETE FROM subscriptiontable WHERE email = '" & Email & "')" end if recordset.close I'm sure there's all sorts of extra tasks you might want to do (for instance grab name information, record signup date & time, confirm that they're not already in the database, etc) . . . But that's the jist of it. |
![]() |
| Viewing: ASP Free Forums > Web Design > Web Layout > Need help to create a code for Newsletter subscriptions |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|