/    Sign up×
Community /Pin to ProfileBookmark

Auto return and refresh pages

I have seen a site developed in PHP where the user can view their member details, and if they wish to update any info, click on a ‘update details’ link which opens a form in a pop-up window. When the user updates the info and clicks submit in the new window, the info is updated, the pop-up window closes and the original window then re-loads to display the updated member info.

I’d like to apply a similar process to a site I am working on, but have no idea how something like that is done. I thought it might be a javascript process running it, but there isn’t any javascript on the page from what I can tell. If anyone knows how this is done, i’d love to know!

cheers
Cowboy Killer

to post a comment
PHP

9 Comments(s)

Copy linkTweet thisAlerts:
@JayMDec 17.2006 — This is not very hard to do. Do you have experience with PHP and SQL? If you have a solid understanding of both, we can guide you through the rest.
Copy linkTweet thisAlerts:
@Cowboy_KillerauthorDec 17.2006 — JayM, yeah, i have a pretty good understanding of both PHP and MySQL. I am keen to hear how it can be done!
Copy linkTweet thisAlerts:
@JayMDec 17.2006 — When the user clicks 'Update Info', what you do is query the SQL database with a SELECT clause, selecting the fields that you want to allow the user to edit, and assign the value of each field to a variable.

You then display your form, with each field value displayed in the text boxes (assuming you will have them displayed in text boxes).

Ex: <input type="text" value="<?php echo $variable_name ?>">

The user can then change the values displayed in the form.

Once the form is submitted, you have to query the database with the UPDATE caluse.

Ex: UPDATE table_name SET age = 12 WHERE member_id = 02

Hopefully this should get you started. If you need any more clarification let me know.

Cheers
Copy linkTweet thisAlerts:
@Cowboy_KillerauthorDec 18.2006 — Thanks but I really don't have a problem with updating the information. What you wrote is all pretty straight forward for me. The problem im having is knowing how to automatically refresh a page when the user returns to it. I'll clarify the process so you know what i'm trying to do.

It starts when a user is viewing details for a certain project in their browser window. One of the parameters relating to the project is whether or not it is dependent upon a pre-existing project. If the user wants to nominate another project here, they click on a link entitled 'add' which uses javascript to open up a pop-up window displaying a list of all the existing projects. Once they have located the project they want to nominate, they click on the radio button for that project and click 'submit'. The form will action itself, and do an 'update' query, adding the nominated project id into the record for the original project.

Now, here's the bit I am uncertain about. Once the record has been updated, the pop-up window automatically closes, returning the user to the main browser window, which then automatically refreshes displaying the updated information. I guess the real question is how does the pop-up window automatically close, and how does the original browser window know that the user has returned to it and subsequently refresh in order to display the up-to-date info?

I was buying concert tickets online the other day from http://www.princebandroom.com.au and their site worked just like this when I updated my contact details and I thought it would be nice to replicate that for my site.

I hope i've been clear describing this. I'm not even sure if it is PHP that is able to control this but I'd appreciate any ideas you have.
Copy linkTweet thisAlerts:
@aussie_girlDec 18.2006 — you can use the meta refresh tag..to refresh the page every 600 seconds

<meta http-equiv="refresh" content="600">
Copy linkTweet thisAlerts:
@Cowboy_KillerauthorDec 18.2006 — Thanks aussie girl. I know about this option, however, i don't want to refresh after a specified amount of time, only when the pop-up window closes because thats the only time any information has been changed.
Copy linkTweet thisAlerts:
@alsarDec 18.2006 — good day friend...,

I think you need a conditional loop, after the submit button you have to close your pop up window and loop to start.
Copy linkTweet thisAlerts:
@Cowboy_KillerauthorDec 18.2006 — I have discovered what is needed here... I have created a conditional loop and provided it all checks out, i need to run the following:
[code=html]
<script language="JavaScript" type="text/javascript">
<!--
opener.location.reload(true);
self.close();
// -->
</script>
[/code]


This closes the pop-up window and refreshes the parent window automatically!

Hey, thanks for all your help!
Copy linkTweet thisAlerts:
@alsarDec 18.2006 — you are welcome friend...
×

Success!

Help @Cowboy_Killer spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.26,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...