refreshing images while editing a record

images php coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
User avatar
php-forum Fan User
php-forum Fan User
Posts: 979
Joined: Thu Feb 17, 2011 6:52 am
Location: Racine, WI

Mon May 23, 2011 8:34 am

You have 2 choices here.

1. You could use AJAX to handle the upload and display.
Here the user can browse for the file to upload and upload it without the entire page refreshing. Upon a successful upload the section with the upload button and picture will refresh to show the uploaded image...

2. Since an upload button is just a submit button you could put all of the data on one form. (The fields they are filling in and the upload file box). Then you just process all of the data at once and redirect based on which button they click

Here you would essentially have 2 buttons "Submit Data" and "Upload Picture" but they are on the same form. If the user clicks upload it will upload the picture THEN submit the form data if it exists, then refresh to the same page (or somewhere else if you want).

If the user clicks Submit Data, you could assume that they aren't uploading a file (but could check if they did) and handle that form data accordingly.

Post Reply