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 .= " $selected>$column\n";
> }
>
>
> print "";
> $selected_session = $HTTP_POST_VARS['titles'];
> print "\n";
>
> print "Change the rank of this workshop, or select another workshop
from
> this session and click the update button.";
>
> print "";
> print "workshopRankWorkshop
Title";
> print "$row1[2] value=$row1[1]> NAME=\"titles\">$title_block\n";
> print "";
> print "";
> print "After you have made your changes, click the Update button
to
> confirm these.";
> print "";
> print "";
>
> print "";
> print "";
>
>
> if ($_POST['Submit']=='Update')
> {
> print "updated!!";
> $rank = $HTTP_POST_VARS['rank'];
> $title_new = $HTTP_POST_VARS['titles'];
> print "rank =$rank";
> print "title# = $title_new";
> $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