The $HTTP_POST_VARS array has no scope within your function. Make it
global for this to work or use $_POST.

function retrieve_select_listing($link, $workshop, $session, $username)
{
        global $HTTP_POST_VARS;
        //rest of your code...

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/

> -----Original Message-----
> From: Peter Gumbrell [mailto:[EMAIL PROTECTED]
> Sent: Sunday, February 23, 2003 7:42 PM
> To: Php-General
> Subject: [PHP] Variables not being received from form
> 
> 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




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to