Page 1 of 1

Real Time Updates

Posted: Wed Jun 16, 2004 4:04 pm
by comtek
I have a form that allows a visitor to make selections from drop down boxes, click a submit button, and have the total of there selections updated on the same page. I want to make this a real time update that is done without having to click a button to update. How can this be done? I have been told it can be done with Sessions, and I have also been told it would have to be done using a client-side javascript. I would prefer to use PHP because this is what I am trying to learn. I have not been able to find any relevant examples of PHP or Java. Any direction would be greatlt appreciated.

Posted: Wed Jun 16, 2004 4:07 pm
by markl999
It will have to be client side for it to be 'real time' (i.e with no new request to the server) and as PHP is on the server side then it can't be done (with PHP).
There's lots of javascript scripts out there that can handle this for you.

Posted: Wed Jun 16, 2004 4:27 pm
by PAW Projects
It can be real time by using a hidden IFRAME.
On selection of one of the options in the dropdown, a javascript file is loaded into the IFRAME, which in turn changes the content of the page.

With or without the use of PHP, JavaScript is going to be involved.

Posted: Wed Jun 16, 2004 4:28 pm
by feyd
moving to client-side.

Posted: Wed Jun 16, 2004 5:48 pm
by comtek
OK Java it is. Know of any examples? I have been looking but don't know enough about Java to know whether they are appropriate or not. Thanks for your input so far.

Posted: Wed Jun 16, 2004 6:23 pm
by pickle
comtek wrote:OK Java it is.
Just a note that Java and Javascript are two very different languages.

Posted: Wed Jun 16, 2004 7:08 pm
by comtek
Would the html "onchange" command work? At this point I do not need to pull more info from server.... all the choices needed will already be in the drop down boxes. I am currently using some simple PHP code to display the sum of the choices on the same page, once a submit button is hit.

Posted: Wed Jun 16, 2004 7:23 pm
by qads
i am not good with javascript, but here goes...

Code: Select all

<script>
function lable(value)
&#123;
document.layer.bla.text = value;
&#125;
</script>
<layer name="bla"></layer>

<form name="form">
<select name="options" onchange="lable(this.value)">
<option value="value 1">value 1</option>
<option value="value 2">value 2</option>
</select>
</form>
something like that :P, shouldt work (if it does, yay for me), but it should give you a idea it.

Posted: Wed Jun 16, 2004 8:29 pm
by comtek
OK. thanks. This give me good direction and something to work with. Many thanks