Change a button after e-mail

I have a page with a button that sends an e-mail with the data on the page.  The page that sends the e-mail just returns to the original page.  How do I alert the user that they sent the e-mail (grey out or something else).  Should I set a $_SESSION var?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
Yes, a session variable is appropriate for this.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Julian HansenCommented:
There are a couple of options - firstly if the page that processes the click is the same as the page that renders the form then simply gray out the button on the render of the page - you will know that you have sent the email so you can use that to build the logic around rendering out a grayed out button.

Option 2 - send the request by AJAX and gray out the button with JavaScript
breeze351Author Commented:
Got it. Thought that there might be an easier way.
Julian HansenCommented:
In my view AJAX is the easiest option - your backend script only needs logic for sending mail and returning status - no need for rendering an interface. The client script is also very easy - a single AJAX call with a status check in the callback.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.