$_SESSION['currentbid'] isn't available until you do session_start();

session_start();
unset($_SESSION['currentbid']);

Or is this what does connect.inc contains?

-Kevin

  ----- Original Message ----- 
  From: [EMAIL PROTECTED] 
  To: Kevin Stone 
  Cc: [EMAIL PROTECTED] 
  Sent: Monday, July 08, 2002 1:43 PM
  Subject: Re: [PHP] UNSETing Session Variables



  I more or less figured that. below is the code for the two pages in question. 

  Page 1: 
  <? 
    require("connect.inc"); 
    unset ($_SESSION['currentbid']); 
  ?> 
  <HEAD> 
    <TITLE></TITLE> 
  </HEAD> 
  <BODY> 
  Borrowers 
  <TABLE BORDER="1"> 
  <TR> 
  <? 
    /* Get all users select call */ 
    $users = mysql_query("SELECT  bname, bphone, address, admin, bid FROM Borrowers 
ORDER BY bname"); 

    echo "<TH>";  echo "Name";  echo "</TH>"; 
    echo "<TH>";  echo "Phone";  echo "</TH>"; 
    echo "<TH>";  echo "Address";  echo "</TH>"; 
    echo "<TH>";  echo "Admin";  echo "</TH>"; 
    echo "<TR>"; 

    if($users) 
      while($row=mysql_fetch_row($users)) 
      { 
        echo "<TR>"; 
        echo "<TD> $row[0] </TD>"; 
        echo "<TD> $row[1] </TD>"; 
        echo "<TD> $row[2] </TD>"; 
        if($row[3]) 
          echo "<TD> Yes </TD>"; 
        else 
          echo "<TD> No </TD>"; 
        print "<TD> <FORM METHOD=\"post\" action=\"uupdate.php\"> 
                    <input type=\"hidden\" name=\"ubid\" value=\"$row[4]\"> 
                    <INPUT TYPE=\"SUBMIT\" VALUE=\"Change User.\"> 
                    </FORM> </TD>"; 
        print "<TD> <FORM METHOD=\"post\" action=\"udelete.php\"> 
                    <input type=\"hidden\" name=\"ubid\" value=\"$row[4]\"> 
                    <INPUT TYPE=\"SUBMIT\" VALUE=\"Delete User.\"> 
                    </FORM> </TD>"; 
        print "<TD> <FORM METHOD=\"post\" action=\"uadmin.php\"> 
                    <input type=\"hidden\" name=\"ubid\" value=\"$row[4]\"> 
                    <INPUT TYPE=\"SUBMIT\" VALUE=\"Make Admin.\"> 
                    </FORM> </TD>"; 
        echo "</TR>\n"; 
      } 
  ?> 
  </TR> 
  </TABLE> 

  <? require("tail.inc") ?> 

  page2: 
  <? 
    require("connect.inc"); 
  ?> 
  <HEAD> 
    <TITLE> User Update Page </TITLE> 
  </HEAD> 
  <BODY> 
  <BR> 
  <BR> 
  <? 
    print "$currentbid-current, $ubid-change, $bid-current"; 
  ?> 

  <? 
    if($admin) 
      $currentbid = $ubid; 
    else 
      $currentbid = $bid; 
    $result = mysql_query("SELECT bname, bphone, address FROM Borrowers Where 
bid=$currentbid"); 
    if($result) 
    { 
      $row = mysql_fetch_row($result); 
      $oname = $row[0]; 
      $ophone = $row[1]; 
      $oaddress = $row[2]; 
    } 
  ?> 

  Please enter the new information into the fields below. 
  <TABLE BORDER> 
    <TR><TH> Current Information </TH></TR> 
    <TR><TH><FORM method="post" action="ucupdate.php"> 
    <INPUT TYPE="text" NAME="uname" value=<?print "'$oname'"?> SIZE="30"></TH> 
    <TH><INPUT TYPE="text" NAME="uphone" value=<?print "$ophone"?> SIZE="30"></TH> 
    <TH><INPUT TYPE="text" NAME="uaddress" value=<?print "'$oaddress'"?> 
SIZE="30"></TH></TR> 
  <? 
    if($admin) 
    { 
      print "<TH><INPUT TYPE=\"text\" NAME=\"upassword\" value="; 
      $cpass = mysql_query("SELECT admin_pass FROM Borrowers WHERE bid=$currentbid"); 
      $cpassr = mysql_fetch_row($cpass); 
      print "\"$cpassr[0]\" ";       
      print "SIZE=\"30\"></TH></TR>"; 
    } 
  ?> 
  </TABLE> 
  <INPUT TYPE="SUBMIT" VALUE="Submit your information."> 
  <INPUT TYPE="RESET"  VALUE="Clear"> 
  </FORM> 

  <? require("tail.inc"); ?> 


  The first page gives the admin user a list of users, and three options (change their 
information, delete them, or make them and Admin).  The option we are choosing is to 
change information.  If I select user number 1 the only way to edit another user is to 
log out and log back in. 

  If any of the code is unclear please let me know.  I haven't gotten to commenting it 
all yet. 

  Jed 


       "Kevin Stone" <[EMAIL PROTECTED]> 
        07/08/2002 12:47 PM 

               
                To:        <[EMAIL PROTECTED]> 
                cc:         
                Subject:        Re: [PHP] UNSETing Session Variables 



  We're going to need to see some of your code to help you further.
  -Kevin
   ----- Original Message ----- 
   From: [EMAIL PROTECTED] 
   To: Kevin Stone ; [EMAIL PROTECTED] 
   Sent: Monday, July 08, 2002 12:15 PM
   Subject: Re: [PHP] UNSETing Session Variables



   I tried to enter the comand as such 
     unset ($_SESSION["choice"]); 

   I thought everything in php was double quotes. but even with single quotes it still 
isn't quite working.  If I do it on the first page then it won't let a later command 
assign anything to the variable, but if I do it on a seperate third page, it doesn't 
reset anything. 

   I have been trying to avoid unregistering variables and then reseting them.  Seems 
a little too messy for my programming tastes. 

   Jed 



        "Kevin Stone" <[EMAIL PROTECTED]> 
         07/08/2002 12:01 PM 

                
                 To:        <[EMAIL PROTECTED]>, <[EMAIL PROTECTED] 
                 cc:         
                 Subject:        Re: [PHP] UNSETing Session Variables 



   unsset($_SESSION['choice']);
   // .. or .. //
   session_unregister('choice');

   -Kevin

   ----- Original Message -----
   From: <[EMAIL PROTECTED]>
   To: <[EMAIL PROTECTED]>
   Sent: Monday, July 08, 2002 11:54 AM
   Subject: [PHP] UNSETing Session Variables


   > I am having a slight problem unseting some session variable.
   >
   > here is an exaple of what I have
   >
   > Page1:
   > choice: 1
   > choice: 2
   > choice: 3
   > choice: 4
   > Click on Submit button after choosing 1, 2, 3, or 4
   >
   > Page 2:
   > Loads information from previoius choice.
   > Start over again
   >
   > I am using a session variable for choice and am trying at the beginning of
   > page 1 to unset the session variable, but it is never beign over written
   > or rest.
   >
   > Please Help
   >
   > Jed


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







Reply via email to