Basically I am looking for a very simple popup box to come up after a user hits the submit button. I don't want it to say "Are you sure you want to submit this" or anything like that just simply "Thank you for your submission". Ideally the page would be reloaded (which I know how to get that working) and then the popup would show up. Any ideas? I have googled and couldn't find this everything I found were for confirmation popup's not this. Pretty much just like this dialouge box in this link but just plain and just saying "Thank you for your submission" with a close button.
http://www.premiumpixels.com/freebies/popup-modal-window-psd/

Recommended Answers

All 5 Replies

<form method="post" id="some_id" action="process.php" onSubmit="alert('Thank you!');" >

EDIT: Sorry I realized you wanted something on the reload and not before leaving.. What you can do is in the PHP script, add small code to change the content of a file to 1 from 0 after you do the saving of the user inputed data.

Now when the page reloads, check if the content is 1, if it is, then set it to 0 and display whatever message you like.

You can do the styling parts yourself, I hope that was clear enough! :)

I understand the code snipet you gave, but I do not understand what you mean by check if the content is 1 and if not change to 0.

So what you want is a message when someone has submitted the form right? From what you tell me, the same page reloads and then you want the pop up to show up right?

Well, if I had to do that, I would set a text file (or a cookie) to a value of 1 (indicating the form was submitted). If 1 is detected, then you show whatever message you wanted to show and reset it back to 0 so next time when someone submits the form, it will be set to 1 again and so on and so on...

1.<form method="post" id="some_id" action="process.php" onSubmit="return confirm('are you sure?\nIf all fields are not complete the form will not submit');" >

with some simple text formatting, a \n newline to break the text into manageable areas

on the form handloer load have php echo a short html scrap, sonmething like

 <?php 
            // form handler script
            if( isset($_POST['something that is set in the form'])) /* you know, the whole validator thing*/
            { echo <<<EOT
            <<div id='demolayer' style='position:fixed;top:100px;width:55%;left:auto;right:auto;z-index:100;text-align:center;'>
            Thank you for your submission<br>
            <button onclick='document.getElementbyID("demolayer").style.visibility="hidden";'>hide</button></div>
            EOT; }
            //rest of php handler
            ?>\
            html

I havent checked the code, its a thought exercise for me,

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.