Sending Email without opening new page

the mail() function

Moderators: macek, egami, gesf

yossi
New php-forum User
New php-forum User
Posts: 1
Joined: Wed Oct 24, 2012 2:10 pm

Sending Email without opening new page

Postby yossi » Wed Oct 24, 2012 2:17 pm

I need to send Email from a html form. I did it with php mail function, but I don't want the server to send a new html page, I want to stay with the first html page (where the form was written). How can I do that?

User avatar
egami
php-forum GURU
php-forum GURU
Posts: 2196
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT

Re: Sending Email without opening new page

Postby egami » Thu Oct 25, 2012 8:00 am

investigate AJAX/Javascript

seandisanti
php-forum Fan User
php-forum Fan User
Posts: 838
Joined: Mon Oct 01, 2012 12:32 pm

Re: Sending Email without opening new page

Postby seandisanti » Tue Nov 13, 2012 1:44 pm

Do you care if page is reloaded? Because you can have self processing page, where the form action is the same page, and then in the page just check if (isset($_POST)) and handle form data if it is. If you're trying to avoid server requests, ajax is the way to go because you can update just the relevant portion of the page. or if you just want to leave the form up after completion, you can have a self processing page that populates the form fields with the post data when its responding to a post. without seeing your code or knowing exactly what you're going for all we can do is guess

seandisanti
php-forum Fan User
php-forum Fan User
Posts: 838
Joined: Mon Oct 01, 2012 12:32 pm

Re: Sending Email without opening new page

Postby seandisanti » Mon Nov 19, 2012 9:33 am

There is no additional detail at that site, spam post


Return to “PHP coding => Mail”

Who is online

Users browsing this forum: No registered users and 0 guests