php combobox & button should hide once updated into mysql db and show success message instead of combobox & button place. -
here updated 1 field value through user input form (combo box type). update process working perfectly. but, after data stored in db should show value i'm selected in combo box , combox box & update button must hide once updated , should show message "updated successfully" instead of combo box & button. not using javascript alert method. not alert message. once updated data in db combo box should hide , success message should show in particular .
this main page coding :
while($a_row = mysql_fetch_array($sql)) { echo "\t<td>" . $a_row['guestname'] . "</td>"; echo "\t<td>" . $a_row['agentname'] . "</td>\n"; echo "\t<td><form action=statusdb.php method=post> <select name=update><option value=empty></option><option value=confirm>confirm</option><option value=processing>processing</option><option value=pending>pending</option><option value=cancelled>cancelled</option></select> <input name=id type=hidden value='".$a_row['slno']."';> <input type=submit value=update> </form> </td>\n"; echo "</tr>\n"; }
this statusdb coding :
if (isset($_post['id'])) { $id = mysql_real_escape_string($_post['id']); $update= mysql_real_escape_string($_post['update']); $sql = mysql_query("update guest_details set status = '$update' slno = '$id'"); if(!$sql) { die("error" .mysql_error()); } else { echo "<html><body onload=\"alert('status updated successfully');\"></body></html>"; } }
i'm thinking work.
try adding following after line echoing agentname:
if ( $a_row['status'] != 'empty' ) { echo "\t<td>" . $a_row[$status] . "</td>\n"; } else { // here's you'd put next 6 lines }
ps: don't see opening <tr>
tag.
Comments
Post a Comment