maliary Posted June 7, 2007 Share Posted June 7, 2007 Hi, I am working on an edit and save functionality. First let me give a description of the situation - I get to display parameters by clicking on a selection box of parameter groups.what is displayed is the parameter name and the parameter value text box. I enter values in the text box and save them.Then get back on the same page where i can edit the parameters or add new parameters. Which is the headache. Here is my code: To obtain the test parameters: //displays code from parameter_table but if there is a match with the groups, It should display the params //entered in the findings_table. //params obtained from the findings_table are in the form of an array called $nval. //values obtained from the findings_table are in the form of an array called $pval. while($tp=$tparams->FetchRow()){ $fir = $tp['lo_bound']; $mst = $tp['hi_bound']; $ranges = "$fir - $mst"; $msr_unit = $tp['msr_unit']; # first column echo '<td bgcolor="#ffffee" class="a10_b"><nobr> <b>'; // Display name from param table but if their is a match display from findings table if ($parameterselect == 3){ // display from findings table :from an array for ($kol=0; $kol<$numname; $kol++) { // echo "<td><nobr> <input name=tname".$kol." type=hidden size=7 value=$nval[$kol]> </nobr></td>"; $tp['name'] = $nval[$kol]; echo $tp['name']; } }else { if(isset($parameters[$tp['id']])&&!empty($parameters[$tp['id']])) echo $parameters[$tp['id']]; else echo $tp['name']; echo '</b> </nobr></td>'; } # hidden echo "<td><nobr> <input name=name".$counter." type=hidden size=7 value=$tp[name]> </nobr></td>"; echo "<td><nobr> <input name=ranges".$counter." type=hidden size=7 value=$tp[lo_bound]-$tp[hi_bound]> </nobr></td>"; echo "<td><nobr> <input name=msr_unit".$counter." type=hidden size=7 value=$tp[msr_unit]> </nobr></td>"; # second column if ($parameterselect == 3) { for ($pol=0; $pol< $numpara; $pol++) { echo "<td class=a10_b><input name=test_value.".$counter." type=text size=8 value=$pval[$pol]>$tp[msr_unit] </td>"; } }else { echo "<td class=a10_b><input name=test_value.".$counter." type=text size=8>$tp[msr_unit] </td>"; } $counter++; } The problem is that it displays either from the param table or findings table but not both. It needs to display from findings table if group findings match or from param table if they don't. how can I do this? Quote Link to comment https://forums.phpfreaks.com/topic/54563-edit-and-save/ Share on other sites More sharing options...
maliary Posted June 7, 2007 Author Share Posted June 7, 2007 Is this possible? Quote Link to comment https://forums.phpfreaks.com/topic/54563-edit-and-save/#findComment-269931 Share on other sites More sharing options...
SoulAssassin Posted June 7, 2007 Share Posted June 7, 2007 If I understand correctly, you want a dynamic form which gets values from the database as you select them in you form? If this is true, then you should use something like Ajax to get the values of selected, and Update each one separately. http://www.ajaxtutorial.net/ Quote Link to comment https://forums.phpfreaks.com/topic/54563-edit-and-save/#findComment-269943 Share on other sites More sharing options...
maliary Posted June 7, 2007 Author Share Posted June 7, 2007 The form is already there and it does display data from a database. It works like :- 1. I select data from a drop down and based on that it extracts data from a database. 2. I can enter values in the text boxes and save. What am trying to do is :- 1. upon clicking on the save button the user is redirected back to the same page,with the inserted data appearing in the text boxes and can be edited and an update performed. 2. Apart from the edits the user can still select groups,enter and save values. Quote Link to comment https://forums.phpfreaks.com/topic/54563-edit-and-save/#findComment-270017 Share on other sites More sharing options...
maliary Posted June 8, 2007 Author Share Posted June 8, 2007 bump, want to see the entire form? Quote Link to comment https://forums.phpfreaks.com/topic/54563-edit-and-save/#findComment-270548 Share on other sites More sharing options...
jeeva Posted June 8, 2007 Share Posted June 8, 2007 you can get this by using ajax............ Quote Link to comment https://forums.phpfreaks.com/topic/54563-edit-and-save/#findComment-270555 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.