Click to See Complete Forum and Search --> : Button click event


alon
01-12-2006, 07:25 PM
Hi,
I wrote an ASP code that sends a form by e-mail.
My problem is how to connect the code to the Submit button click.
The code I currentky have sends the mail on button click, but also send it upon loading or refreshing the page. How do I prevent it ?
As I understand, the buttons OnClick event is a client event. What do I do ?
Thanks
Alon

jvanamali
01-12-2006, 11:18 PM
call the email page on click of a button which is on another page

i.e the firstpage.asp contains the button on the click of the button u call the sendemail.asp page and after sending the email redirect to firstpage.asp

silverbullet24
01-13-2006, 09:15 AM
or just check for form submission when the page is loaded like this

if request.form("submit") <> "" then
email code here
else
rest of the html page with form
end if

"submit" is the name of your form submit button

Bullschmidt
01-15-2006, 09:04 PM
And for a somewhat related link:

Classic ASP Design Tips - Post Back Page
http://www.bullschmidt.com/devtip-postbackpage.asp

alon
01-16-2006, 03:01 AM
Thanks everyone :). You are kind kind people.