Jump to content

no refresh after update


kenny22

Recommended Posts

i have set up a search form which is linked to dynamic update form on the same page,

 

when you pick an item from listbox in form 1 it will populate form2 (update form) with the  data from DB and repeat for all matching records, the update of the form is done by using a checkbox (onclick), all this works fine and DB updates fine.

 

My problem is when i check a  checkbox in any of the update forms the data is updated but all the update forms are removed so if i want to update another record i need to  enter original search again to  get forms to display again

 

i know the problem is because the page is refreshing when onclick is activated and it loses the search value so returns empty form.

 

i know you can use java to stop page refreshing but never used it before and been trying to get it to work with no success, is there any other way to keep page from refreshing

Link to comment
Share on other sites

Not completely understanding what is going on, but if you're submitting a form, using the normal submit process, the page has to reload and cannot be stopped. You could do this with Ajax and the page wouldn't refresh, but instead your client side Javascript would make all the necessary changes after its call to the server.

Link to comment
Share on other sites

i've narrowed down the problem to this bit of code

 

$colname_rsTeamselect = "-1";
if (isset($_POST['team'])) {
  $colname_rsTeamselect = $_POST['team'];

 

when i click to update form it  reloads form  using $colname_rsTeamselect = "-1"; instead of holding the previous value of $colname_rsTeamselect

 

so i'm looking for a way to hold the value of $colname_rsTeamselect until a new $_POST['team'] is entered from search box

 

Link to comment
Share on other sites

:D

got it working by using session variable

 

$colname_rsTeamselect = $_SESSION['category'];
if (isset($_POST['team'])) {
  $colname_rsTeamselect = $_POST['team'];
  $_SESSION['category'] = $_POST['team']; 

 

 

may not be correct way but it works

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.