Thanks to those who have helped me with my two other questions this afternoon. In the function below, the update query at the end is inserting empty values into the database. For some reason the lines: $rank = $HTTP_POST_VARS['rank']; $title_new = $HTTP_POST_VARS['titles'];
re not picking up the form values. Here is the complete function. I do not have a form action set so that I can read the SQL message. The update query is working. function retrieve_select_listing($link, $workshop, $session, $username) { $query_retrieve = "SELECT choice_ID, rank, workshop_id FROM choices_peter WHERE workshop_ID = '$workshop' AND username ='$username'"; $result1 = mysql_query($query_retrieve, $link) or die("display_db_query:" . mysql_error()); $row1 = mysql_fetch_array($result1); $choice_id = $row1[0]; $query_title = "SELECT title, CONCAT(sessionlet, sesnumber) AS SessionID FROM ECOO2003 WHERE sessionlet = '$session'"; $result2 = mysql_query($query_title, $link) or die("display_db_query:" . mysql_error()); while ($columns = mysql_fetch_array($result2)) { $column = $columns['title']; $sessionid = $columns['SessionID']; $selected = ""; if ($sessionid == $row1['workshop_id']) { $selected = "SELECTED"; } $title_block .= "<OPTION name='title' value=\"$sessionid\" $selected>$column</OPTION>\n"; } print "<tr><td colspan=\"4\">"; $selected_session = $HTTP_POST_VARS['titles']; print "<form method=\"POST\" name=\"update_workshop\" action=\"\">\n"; print "Change the rank of this workshop, or select another workshop from this session and click the update button.<br><br></td></tr>"; print "<tr><td colspan=\"4\"><table border=\"1\" width=\"80%\">"; print "<tr><th>workshop</th><th>Rank</th><th>Workshop Title</th></tr>"; print "<tr><td>$row1[2]</td><td><input type = \"text\" name =\"rank\" value=$row1[1]></td><td><SELECT NAME=\"titles\">$title_block</SELECT></td></tr>\n"; print "<tr><td colspan =\"3\">"; print "<input type=\"hidden\" name=\"update_select\" value=\"v\">"; print "<br>After you have made your changes, click the Update button to confirm these.<br></td></tr><tr><td>"; print "<INPUT TYPE=\"Submit\" NAME=\"Submit\" Value=\"Update\"></td>"; print "<td></td><td></td></tr>"; print "</table>"; print "</form>"; if ($_POST['Submit']=='Update') { print "updated!!"; $rank = $HTTP_POST_VARS['rank']; $title_new = $HTTP_POST_VARS['titles']; print "rank =$rank<br>"; print "title# = $title_new<br>"; $query_update = "UPDATE choices_peter SET rank = '$rank', workshop_id = '$title_new' WHERE choice_ID = '$choice_id'"; $update = mysql_query($query_update, $link) or die("display_db_query:" . mysql_error()); } } Many thanks Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php