Session Variable not being written ?

From: Date: Tue, 11 Jul 2000 16:07:59 +0000
Subject: Session Variable not being written ?
Groups: php.general 
Request: Send a blank email to php-general+get-5938@lists.php.net to get a copy of this message
This is a script from an auction site I am writing for a school projcect, I know it can probably be improved on dramatically considering I am relatively new to php. My question is simple, How come none of the values in the while loop are being written the session variable(array) $BIDSESSION? They are outputting the correct values but they are not being written to the session file. P.S. There may be obvious mistakes in this code as I have been fighting with it all morning. -Mark /* * detail.php3 - this file is gonna be used to print out auction items by category and allow bidding on items */ include 'shared-functions.php3'; site_header("Auction4Fun - View Detail/Bid on Item"); if($STARTSESSION["logged_in"] == "false"){ echo "<script> <!-- confirmMsg('You must be registered and logged in before bidding on items. Click ok and you will be automatically redirected to the registration page') ; --> </script> " ; } if(!isset($BIDSESSION)){ session_register("BIDSESSION"); } if(isset($BIDSESSION["item_new_bid"])){ if($BIDSESSION["item_new_bid"] <= $BIDSESSION["item_high_bid"]){ if($BIDSESSION["item_new_bid"] ^ $BIDSESSION["item_bid_increment"] != 0){ echo "Your bid must be greater than "; echo $BIDSESSION["item_high_bid"]; echo " by at least "; echo $BIDSESSION["item_bid_increment"]; } } } $db='items'; $table='auction_items'; $conn=mysql_connect("localhost","root","password_here"); $result_query="select * from $table where item_id='$item_id'" ; file://echo $result_query; $result = mysql_db_query("$db","$result_query"); file://HTML code generated here while($BIDSESSION = mysql_fetch_array($result)){ ?> <br> <table width="100%" border="0" align="center" cellspacing="0" cellpadding="0" height="362" name="detail"> <tr bgcolor="#0000CC"> <th colspan="3"> <font color="#FFFF66">Detail for Item # <? echo $BIDSESSION["item_id"]; echo ": "; echo $BIDSESSION["item_name"]; ?> </font></th> </tr> <tr> <th bgcolor="#FFFFFF" width="16%">&nbsp;</th> <th width="39%">&nbsp;</th> <th width="45%">&nbsp;</th> </tr> <tr valign="top" bgcolor="#FFFFCC"> <th width="16%" bgcolor="#FFFFFF" align="left">Item Number:</th> <td height="30" width="39%" bgcolor="#FFFFFF"> <p> <? echo $BIDSESSION["item_id"]; ?> <!-- end completly generated HTML --> </p> </td> <td height="100%" width="45%" rowspan="11"> <form method="post" action="detail.php3" onSubmit="MM_validateForm('item_new_bid','','RisNum');return document.MM_returnValue"> <p><font color="#000066">Bid on item#Name of item<br> <input type="hidden" name="item_id" value=""> </font></p> <p><font color="#000066">Current High Bid is:&nbsp;</font></p> <p><font color="#000066">Your Bid: <input type="text" name="item_new_bid" size="8" maxlength="8"> </font></p> <p><font color="#000066">Bids must be in increments of:&nbsp;<br> </font></p> <p><font color="#000066">Quantity: <input type="text" name="quantity" size="4" maxlength="8" onChange="MM_validateForm('item_new_bid','','RisNum');return document.MM_returnValue"> </font></p> <p> <font color="#000066"> <input type="submit" name="bid" value="Enter Bid"> <input type="reset" name="reset" value="Clear Bid"> </font></p> <p><font color="#FF3333">*You will be contacted by email if you win this auction.<br> * All auctions end on the date specified above at 1200pm</font><font color="#000066">.</font></p> </form> </td> </tr> <tr valign="top" bgcolor="#FFFFCC"> <th width="16%" bgcolor="#FFFFFF" align="left">Item Quantity:</th> <td height="30" width="39%" bgcolor="#FFFFFF"> <? echo $BIDSESSION["item_quantity"]; ?> </td> </tr> <tr valign="top" bgcolor="#FFFFCC"> <th width="16%" bgcolor="#FFFFFF" align="left">Item Name:</th> <td height="30" width="39%" bgcolor="#FFFFFF"> <? echo $BIDSESSION["item_name"]; ?> </td> </tr> <tr valign="top" bgcolor="#FFFFCC"> <th width="16%" bgcolor="#FFFFFF" align="left">Description:</th> <td height="30" width="39%" bgcolor="#FFFFFF"> <? echo $BIDSESSION["item_description"]; ?> </td> </tr> <tr valign="top" bgcolor="#FFFFCC"> <th width="16%" bgcolor="#FFFFFF" align="left">High Bid:</th> <td height="30" width="39%" bgcolor="#FFFFFF"> <? echo $BIDSESSION["item_high_bid"]; ?> </td> </tr> <tr valign="top" bgcolor="#FFFFCC"> <th width="16%" bgcolor="#FFFFFF" align="left">Bid Increment:</th> <td height="30" width="39%" bgcolor="#FFFFFF"> <? echo $BIDSESSION["item_bid_increment"]; ?> </td> </tr> <tr valign="top" bgcolor="#FFFFCC"> <th width="16%" bgcolor="#FFFFFF" align="left">Posted:</th> <td height="30" width="39%" bgcolor="#FFFFFF"> <? echo $BIDSESSION["time_posted"]; ?> </td> </tr> <tr valign="top" bgcolor="#FFFFCC"> <th width="16%" bgcolor="#FFFFFF" align="left">Auction Close:</th> <td height="30" width="39%" bgcolor="#FFFFFF"> <? echo $BIDSESSION["item_auction_close"]; ?> </td> </tr> <tr valign="top" bgcolor="#FFFFCC"> <th width="16%" bgcolor="#FFFFFF" align="left" height="37">Posted By:</th> <td height="37" width="39%" bgcolor="#FFFFFF"> <? echo "<a href=\"mailto:"; echo $BIDSESSION["item_owner_email"]; echo ">\""; echo $BIDSESSION["item_owner_id"]; echo "</a>"; ?> </td> <tr valign="top" bgcolor="#FFFFCC"> <th width="16%" bgcolor="#FFFFFF" align="left">Long Description:</th> <td height="30" width="39%" bgcolor="#FFFFFF"> <? echo $BIDSESSION["item_long_description"]; ?> </td> </tr> </table> <? } mysql_free_result($result); site_footer(); ?>

« previous php.general (#5938) next »