Re: Re: Variables not being received from form

From: Date: Mon, 24 Feb 2003 01:12:11 +0000
Subject: Re: Re: Variables not being received from form
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-136801@lists.php.net to get a copy of this message
Please, please, PLEASE don't correct code that isn't wrong with code that is! Read http://www.php.net/manual/en/language.types.array.php. To answer the original question, the $HTTP_POST_VARS variable is out of scope in your function. Either use $_POST superglobal array if you're using 4.1.0 or higher, or use $GLOBALS['HTTP_POST_VARS']['formvarhere'] pei_world wrote:
cann't see any thing without your form! I think it is misstyping error, check your form variables name, specially upper case or lower case! but try $rank = $HTTP_POST_VARS[rank]; $title_new = $HTTP_POST_VARS[titles]; -- Sincerely your; pei_world ( .::IT::. ) "Peter Gumbrell" <peter@orillia.net> wrote in message news:PJEFLEILOPHKCDBMAAJJOEJGCGAA.peter@orillia.net...
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: 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
-- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.

« previous php.general (#136801) next »