Send email to and then redirect in javascript -


i have website form in it. form takes name, phone, email, company , message.

i want when user clicks submit, email send predefined email account , user send new page.

the code have far this:

<form method="post" action="mailto:test@test.com"> 

this opens email provider prompt. wouldn't bad, can't redirect user after wards then.

is there way javascript, or easier use php?

you can't solely on client side javascript. need use server language, such php, posted data , send email. have choice, redirect on server side or doing client side.

here's php code (note didn't test it):

// email posted data mail('your-address@mail.com', 'new message site',    'name: ' . $_post['name'] .    'phone: ' . $_post['phone'] .    'email: ' . $_post['email'] .    'company: ' . $_post['company'] .    'message: ' . $_post['message']);  // redirect visitor header('redirect-url-here'); 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -