Page 1 of 1

upload and display on the same admin page

Posted: Wed Jun 04, 2008 2:26 am
by abhikerl
Hi, I know the basic stuff of php. I already know how to upload picture and text in the database. But, as you know, the upload page and display page is different. What I want is to upload the picture and the text and display what I upload on the same page.
Any suggestions will be welcome. Thanks a lot :)

http://www.islandinfo.mu

Re: upload and display on the same admin page

Posted: Wed Jun 04, 2008 4:45 pm
by califdon
abhikerl wrote:Hi, I know the basic stuff of php. I already know how to upload picture and text in the database. But, as you know, the upload page and display page is different. What I want is to upload the picture and the text and display what I upload on the same page.
Any suggestions will be welcome. Thanks a lot :)

http://www.islandinfo.mu
There are two things that you may be thinking of. One is to reload the page after uploading the picture and text to the database. Another is to not reload the page, but use Ajax to modify the page by assigning content to otherwise empty controls on the page.

The first is quite easy. On completion of the upload, just call the same script again only pass either a POST or GET parameter to it that your PHP script will test for and if it is present, it will display the uploaded image and text.

The Ajax solution isn't terribly difficult, but it requires additional familiarity with Ajax. Here's a beginning tutorial on Ajax: http://w3schools.com/ajax/ajax_intro.asp