I'm developing a simple instant chatting system. I need to do the following;

I want to refresh a different page when I click submit. Suppose, I've the submit button on page1, on clicking submit, the page2 should be refreshed/reloaded.

How can I do it? I've searched a lot on Google but wasn't able to find anything useful?
Code in JavaScript is welcome as well.

Recommended Answers

All 9 Replies

A lot easier would be to make the page self refreshing within some timespan.

but i don't want the page to be reloaded automatically. I've done so on different pages but on this page, I want the stuff i told earlier.

Member Avatar for diafol

I assume you're using ajax or comet for your chat app. Are you using a db to store messages or are they stored in a file or are they totally volatile (only visible for the duration that the user has his/her page open).

I don't understand why you'd have two different pages for your app.

You need changes from users -> db or file
Each page 'polls' the DB for info every 8 seconds or so - this is initiated by js timeout via php script.

One of the reasons to use ajax (or comet) is that you don't want the page to refresh every time you send a response via the send message form.

You may be able to do something via 'frames' or even an iframe - but that seems extreme.

I'm not using anytype of AJAX code. My instructor wants it in complete PHP.
I need the other page to reload because I'm using a messenger type interface which opens in a web page. There is a fixed width and height of the browser where the main interface page opens. When the user click on change display name button, another window opens in a fixed size. So when the user changes the display name successfully, then I want the main interface page to be reloaded.
I hope I've quite make it simple to understand.

Moreover, should i use simple html code to reload the page after a specific time.

There is no way to give PHP control over your opened windows...

Moreover, should i use simple html code to reload the page after a specific time.

<META HTTP-EQUIV="REFRESH" CONTENT="SECONDS"> Where SECONDS it's amount of time to refresh after.

Alright, thanks for the help.

Member Avatar for diafol

Using pure php for a chat program is crazy. All those reloads?? Yuk. Your tutor needs his head tested. If your sending form and message display are in the same browser window - you'd never finish writing your message before it was refreshed. If they are not on the same browser window - freaky.

Can anyone provide me any instant messenger script in PHP/MYSQL,JAVA?

Member Avatar for diafol

Hold on mate. Who is supposed to be doing this work? It's being assessed I assume, so any merit you receive should be down to YOU. Here's a novel thought - why don't YOU provide the code and ask for help if you get into difficulties, giving contributors on DaniWeb acknowledgements for any help received in your report.

You can start here: http://tinyurl.com/ye9efh8

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.