mysql - HTML Form button in PHP While loop -
i have while loop in php selects data database
i want have complete button each row returned which, when pressed run sql query change value of status
column of particular row
my while loop is:
$stmt = $pdo_conn->prepare("select * messages status = :status , (assigned_to = :assigned_to1 or assigned_to = :assigned_to2) "); $stmt->execute(array(':status' => '', ':assigned_to1' => $user_result["sequence"], ':assigned_to2' => '')); $records = $stmt->fetchall(pdo::fetch_assoc); $i=0; if(count($records) > 0) { echo '<tr> <td colspan="7">you have '.count($records).' messages</td> </tr>'; foreach($records $messages) { $i++; echo '<tr> <td>'.adminnamelookup($messages["assigned_to"]).'</td> <td>'.$messages["caller_company"].'</td> <td>'.$messages["caller_telephone"].'</td> <td>'.$messages["caller_email"].'</td> <td>'.$messages["caller_message"].'</td> <td><input type="submit" name="completemessages['.$i.']" value="" /></td> </tr>'; } }
but i'm not sure on how handle php on submit?
before sending data need create html form tag. , have pass values using input tag values.
format tag should below code.
<form action="" method=""> <input type="" value=""> <input type="submit" name="completemessages['.$i.']" value="" /> </form>
Comments
Post a Comment