Jump to content

Recommended Posts

 

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?

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/54563-edit-and-save/
Share on other sites

 

 

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.

Link to comment
https://forums.phpfreaks.com/topic/54563-edit-and-save/#findComment-270017
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.