www.webdeveloper.com
Results 1 to 3 of 3

Thread: Button should take from just the textboxes in the row and preform an update

  1. #1
    Join Date
    Sep 2010
    Posts
    68

    Button should take from just the textboxes in the row and preform an update

    I have inserted a Update Button to each row. The button should take from just the textboxes in the row and preform an update in "total_Update.php" using the post method.

    PHP Code:
    <script language="javascript" type="text/javascript">
            function Button_update(){    
                            ??enter row:idt,datetime,col1,col2 and col3 to be updated
                document.forms.formupdate.submit();
            }
        </script>

        <?php
            
    echo '<form  name="formupdate' $data['idt'] , '" action="total_Update.php" method="post">';
    echo  
    '<center><table><tr><td><br /><br /><br /><br /></td></tr><tr><th>idt</th><th>datetime</th><th>col1</th><th>col2</th><th>col3</th></tr>';
                    
    $n=0;
                    while (
    $data  mysql_fetch_array($resultMYSQL_ASSOC)) {
                        if (
    $data['idt'] !== null) {
                            
    $n=$n+1;
                            <
    tr><td>';
                            echo '
    <input name="Text' , $n , '" type="text" value"' , $data['idt'] , '" width="25" />', '</td>';
                            $n=$n+1; 
                            echo '
    <td>', '<input name="Text' , $n , '" type="text" value"' , $data['datetime'] , '" width="25" />', '</td>';
                            $n=$n+1;
                            echo '
    <td>', '<input name="Text' , $n , '" type="text" value"' , $data['col1'] , '" width="25" />', '</td>';
                            $totalcol1=$totalcol1+$data['
    col1'];
                            $n=$n+1;
                            echo '
    <td>', '<input name="Text' , $n , '" type="text" value"' , $data['col2'] , '" width="25" />', '</td>';
                            $totalcol2=$totalcol2+$data['
    col2'];
                            $n=$n+1;
                            echo '
    <td>', '<input name="Text' , $n , '" type="text" value"' , $data['col3'] , '" width="25" />', '</td>';
                            $totalcol3=$totalcol3+$data['
    col3'];
                            echo '
    <td>', '<input name="ButtonUpdate' , $data['idt'] , '" type="button" value"Update" OnClick="Button_update" width="25" />', '</td>';
                                          }
                    } 
                    echo '
    <tr><td><input name="Hidden1" type="hidden" /></td><td></td>';
                    echo '
    <td>', '<input name="Texttotalcol1" type="text" value"' , $totalcol1 , '" width="25" />', '</td>';
                    echo '
    <td>', '<input name="Texttotalcol2" type="text" value"' , $totalcol2 , '" width="25" />', '</td>';
                    echo '
    <td>', '<input name="Texttotalcol3" type="text" value"' , $totalcol3 , '" width="25" />', '</td></tr>';
                    echo '
    </table></center></form>
        
    ?>

  2. #2
    Join Date
    Jul 2013
    Location
    Voorheesville NY USA
    Posts
    898
    include all the items in each row in their own form tags

  3. #3
    Join Date
    Jul 2013
    Location
    Voorheesville NY USA
    Posts
    898
    And why are you using js to do the submit? Simply change your 'button' to a 'submit'

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles