Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Aug 2010
    Posts
    713
    Thanks
    165
    Thanked 0 Times in 0 Posts

    Approve button inside while loop

    Hi...

    I have form which data is inside while loop and per row has a approved button, Now I have no idea that when I click the approve button the JO # from that row will display and save to the database.

    here is my code and sample form.

    PHP Code:
    <?php
        error_reporting
    (0);
      
    date_default_timezone_set("Asia/Singapore"); //set the time zone  
    $con mysql_connect('localhost''root','');

    if (!
    $con) {
        echo 
    'failed';
        die();
    }

    mysql_select_db("mes"$con);
    $Date_Shelve =date('Y-m-d H:i:s');  
    ?>
    <html>
    <head>
    <title>Sales Order</title> 
    <link rel="stylesheet" type="text/css" href="kanban.css" />      
    </head>
    <body>
    <form name="loading_kanban" action="" method="post">
    <div id="SR_date">
    <label>Date :</label>
    <input type="text" name="Date_Shelve" id="Date_Shelve" value="<?php echo $Date_Shelve?>" size="16" readonly="readonly" style="border: none;">    
    </div>

    <div id="kanban_table"> 
    <table>
    <th> JO No.</th>
    <th> ETD </th>
    <th> PO No. </th>
    <th> SKU Code </th>
    <th> Description </th>
    <th> PO Req </th>
    <th> Requirements </th>
    <th> Priority</th>

    <?php

    $sql 
    "SELECT ETD, PO_No, SKUCode, Description, POReq 
    FROM sales_order"
    ;
    $res_so mysql_query($sql$con);

    while(
    $row mysql_fetch_assoc($res_so)){

    $ETD $row['ETD'];
    $PO_No $row['PO_No'];
    $SKUCode $row['SKUCode'];
    $Description $row['Description'];
    $POReq $row['POReq'];    

    echo 
    "<tr>
    <td>&nbsp;</td>
    <td>$ETD</td>
    <td>$PO_No</td>
    <td>$SKUCode</td>
    <td>$Description</td>
    <td>$POReq</td>
    <td>&nbsp;</td>
    <td><input type='button' name='priority' value='Approved' id='priority'></td>
    </tr>"
    ;
    }


    ?>

    </table>
    </div>
    </form>
    </body>
    </html>
    Last edited by newphpcoder; 04-19-2012 at 10:01 AM.

  • #2
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,281
    Thanks
    57
    Thanked 523 Times in 510 Posts
    Blog Entries
    5
    So what is the question?
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  • #3
    Senior Coder Dormilich's Avatar
    Join Date
    Jan 2010
    Location
    Behind the Wall
    Posts
    3,215
    Thanks
    12
    Thanked 338 Times in 334 Posts
    but you are aware that all PHP runs before the HTML is sent to the browser and when you have the page in the browser you cannot execute PHP?
    The computer is always right. The computer is always right. The computer is always right. Take it from someone who has programmed for over ten years: not once has the computational mechanism of the machine malfunctioned.
    André Behrens, NY Times Software Developer


  •  

    Posting Permissions

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