Page 1 of 1

Update Without Refresh

Posted: Wed Apr 18, 2012 9:02 pm
by ForSale
Hi all. :D

I am a new comer to PhP but enjoying it so far. I am just curious about one thing though. I have started building a site but would appreciate help in the following regard.

On the sites editing page there will be multiple options the user can play around with such as check boxes, input fields etc to choose and edit information about an item such as a blue shirt(checkbox), with red stripes(input field).

My question be fore i get started on the meat of this project would be is it at all possible for to have this information updated automatically and reflect in the corresponding fields without needing to refresh the page each time to view the changes?

I ask because i have heard this can cause serious problems for people using a screen reader, so would like to make it as easy for the viewers as possible with minimal problems. For eg, is there an inbuilt function in PhP i could use to achive this and just add custom parameters etc?

I appreciate any help you could give regarding this matter.

Re: Update Without Refresh

Posted: Wed Apr 18, 2012 9:23 pm
by Robert07
You can use ajax to do this in real time without refreshing the page (which might be more user friendly for screen readers), or you can load everything into hidden divs and use javascript/css to update what values appear where and which content is shown on the screen at any given time.

Re: Update Without Refresh

Posted: Wed Apr 18, 2012 9:52 pm
by ForSale
Thanks alot, i will definately look into that.

Just out of cusiosity though, with the right functions implemented and such would it be possible to implement this in straight php and html without needing to incorporate other languages?

Re: Update Without Refresh

Posted: Wed Apr 18, 2012 10:32 pm
by Robert07
No, because php is a server side language. When the page is done loading php is done, but Javascript (which is combined with php or other server side code to make ajax) is a client side language which allows for changes to be made dynamically after the page finishes loading.

Re: Update Without Refresh

Posted: Wed Apr 18, 2012 10:35 pm
by Robert07
You can take a look at an article I wrote about ajax to understand the gist of that, it is at http://www.wilycode.com/the-essence-of- ... n-an-hour/.