create a div that overlays on an html file? - php

I have a code (html) and I want it to be a div that overlays on another html file.
I want the div to appear when the user submits his message so it confirms that his message has been successfully sent.
as a conclusion, I want a html file to overlay on another one, so it appears as a form validation in php echo. So it has to be as a popup window validating the user's actions.
How to do it?
Thanks in advance. any help will be highly appreciated

First of all, this is not meant by PHP, it is meant by Javascript or Jquery. What you want here is called modal. To see some implementation for modal you may checkout Jqueryui from this link

Related

PHP: Create button for popup window to display contents of text file

I have a Php application that already has 2 buttons with input on the index page that perform some functions and output to different Php pages. Works good. How do I add a button with no input that would just perform a function and then just display a popup window showing the contents of a text file? I want to add several of these buttons for different functions and just display the contents of the resulting text files in popup windows. If it's a simple HTML solution forgive me for labeling it as PHP. Any help would be greatly appreciated. Thanks in advance.
You just need to define a click function for the required button and need to call window.open(). Check out this FIDDLE
More on window.open()

add a new record on a popup and refresh parent with results using Ajax

I am building a page with a button which opens a popup and allows to create a new record in MySQL table. Now I would like to refresh part of the parent page with summary results after the popup window closed. Could you please let me know if there are any examples or sample code? I gooled but couldn't find any example. Thanks for your help.
Are you using any JS lib?
Assuming you are using jQuery + jQuery UI for popup, you can look at jQuery UI modal form example (one note - there is no ajax used, but it's fairly simple to do so).
Idea is simple, bind to onClose popup event, serialize form, submit, and insert recived data into page content.
I guess you will need to call javascript function of parent which will change a particular div based upon your requirement..

Hide information box forever after close with jquery, ajax, php, mysql

So I am wondering the best way to go about this and thought I'd get some input.
I have information boxes with close buttons on them. I am currently using jquery to hide the boxes.
The problem is, if the user closes the information box, I would like the box to stay closed forever.
I imagine I need to set up a table in the database to know whether to show the div or not. I would also like to use AJAX on the click of the close button to send the data to the database.
Would this be the best solution? Thanks in advance
tag each div with a specific class
$('div.class').live('click', fncAddClick); // this is in case you do lazy load
function fncAddClick(e) will call an ajax function to to mark it for deletion, then after the ajax is done on .success(), have it remove the div.
When you click on close button on the information boxes, they just hide from browser but not removed from html dom element.
If you want to remove permanently from html dom then you have to use following code..
If the information box id is "informationBox" then it will accomplished by
$("#informationBox").remove();
Try this, hope this will help..

jquery modal form

i try to do a jquery modal form. the problem is, i include myform.php into the jquery's DIV.
the reason why i put myform.php into jquery's div because i want the php do some input validation/checking exiting data in the database instead of using jquery validation. everything works fine. But the problem is, after i save the data, and the modal was close, then i try refresh the page. then i will get some message saying that "Retry to submit.. blabla..bla..bla..." how to avoid this message? or is there any way to integrate php form with PHP??
You could try and not submit the form and send the $_POST data through AJAX .
i think the new page added to current page div element
may be you should clear the content of div element after closing dialog

how do I load partial pages in lightbox using ajax?

thanks for coming in and looking at my question.
I have a page that has a bunch of dynamic a tags with ids like aTag1, aTag2 ans so on.
now I need to make these tags open the same lightbox that initially loads a partial page named register.php,
and the user will fill out the form, sumbit it then go to another partial page named payment.php and go on until the registration and payment are all settled.
this process needs to be done using ajax.
I think this should be relatively easy if appropriate ajax plugin is used.
Could you please advise any plugins and tips?
Thanks a bunch!
Check out jQuery and jQuery UI Dialogs. Of particular interest to you would be the modal form demo. If you definitely need to have the content loaded from separate URLs, you could put an iframe in the dialog or do something like this example.

Categories