Forum Moderators: coopster

Message Too Old, No Replies

Selective refresh of part of a webpage

Selective refresh of image code

         

aragornking

3:10 pm on Nov 8, 2003 (gmt 0)

10+ Year Member



Hi. I asked about this topic in the "New to Web Development" forum but got no response. I am requiring visitors to a guestbook to first enter a code embedded in a GD-library-created image in order to submit their guestbook entries. Occasionally the fonts in the code may not be very readable, and I would like the visitor to be able to selectively refresh the image (to get a more legible code) without refreshing the entire page (and having to retype their name, comment, etc. entries).

May I ask which would be the best way to go about accomplishing this where the image until now is integrated into the guestbook table (between <td>..</td> tags)? I could either refresh the whole page while somehow turning off deletion of the visitor's entries, or I could place the image+code in a separate frame, with its own refresh capability.

I should add that this is a PHP/MySQL-based (+ HTML) guestbook effort in which I am trying to teach myself some PHP and MySQL.

Thanks for reading this,
Eugene

dcrombie

4:16 pm on Nov 8, 2003 (gmt 0)



I think you'll need JavaScript for this one.

<FORM ...>
<IMG name="myimage" src="somescript.php">

<INPUT type="button" value="Test" onClick="document.images.myimage.src='somescript.php?<?PHP echo time()?>';">
</FORM>

That _should_ reload the image with a new one: somescript.php?1068307975

This assumes that you have a PHP script, 'somescript.php' which returns a valid image file. If the refresh doesn't work, you might have to look at the JS image functions - something like image.reload('newimage')?!?

;)

aragornking

7:03 am on Nov 9, 2003 (gmt 0)

10+ Year Member



Thanks dcrombie. You may be correct about the JS. I guess I will have to learn some.