The form is outputting as a consequence of the condition in: if($submit)
testing false. Maybe this is happening because you don't have register_globals turned on so that $submit never gets populated from the <INPUT TYPE='submit' VALUE='Submit' NAME='submit'> form element. miguel On Tue, 23 Apr 2002, Jennifer Downey wrote: > Ok I have hard coded $quantity so it does = 0 and else still prints. > "Maxim Maletsky )" <[EMAIL PROTECTED]> wrote in message > 004701c1eaf1$c915c6b0$92e3021a@machine52">news:004701c1eaf1$c915c6b0$92e3021a@machine52... > > > > Try this, Jennifer: > > > > Without messing the rest of your code, change the line: > > > > $quantity = $row['quantity']; > > > > With this one: > > > > $quantity = 0; > > > > In other words: hardcode it for testing. > > > > If "else" always prints, then you are missing something in your query. > > Otherwise you've got something wrong in your code. > > > > > > > > > > > > Sincerely, > > > > Maxim Maletsky > > Founder, Chief Developer > > > > www.PHPBeginner.com // where PHP Begins > > > > > > > > > > -----Original Message----- > > From: Jennifer Downey [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, April 23, 2002 7:48 PM > > To: [EMAIL PROTECTED] > > Subject: Re: [PHP] If else question > > > > > > Ok you asked for it. > > Don't say I didn't warn you. > > > > session_start(); > > $query = "SELECT name FROM {$config["prefix"]}_users WHERE > > uid={$session["uid"]}"; $ret = mysql_query($query); while($row = > > mysql_fetch_array($ret)) { > > > > $user = $row['name']; > > > > > > > > $query = "SELECT uid, id, iname, image, quantity, type FROM > > {$config["prefix"]}_my_items WHERE uid={$session["uid"]} AND id = '$id' > > ORDER BY id"; $ret = mysql_query($query); while($row = > > mysql_fetch_array($ret)) { > > $uiid = $row['uid']; > > $iid = $row['id']; > > $image = $row['image']; > > $iname = $row['iname']; > > $quantity = $row['quantity']; > > $type = $row['type']; > > // this is the problem if statement. Please don't yell at me for my > > style. It is easy for me to read so I'm sorry if it's not for you. > > if($quantity < 1) { echo "Sorry I can't seem to locate this item"; } > > else { > > > > session_register("uiid"); > > session_register("iid"); > > session_register("image"); > > session_register("iname"); > > session_register("quantity"); > > session_register("type"); > > > > > > if($iid == $id) > > { > > > > $display_block .="<CENTER><img src=$image border=0><br><font size = > > 2>$iname<BR>$quantity<BR>$type<BR></font></CENTER>"; > > > > echo "$display_block<BR><BR>"; > > > > if($type == "food") > > //if the item food is present then set an option and include in > > the form later > > { > > $thisoption="<OPTION VALUE=\"feed\">Feed my pet\n</OPTION>"; > > } > > else > > { > > //if book or weapon is present then set a blank > > $thisoption=""; > > } > > } > > } > > } > > } > > //check if form has been submitted > > if($submit) > > { > > > > } > > else > > { > > > > //if the form has not been submitted run the following > > > > > > echo "<FORM ACTION='$PHP_SELF' METHOD='post'>"; > > echo "<SELECT NAME='sort' SIZE='1' >"; > > echo "$thisoption"; > > echo "<OPTION VALUE='shop'>Put in my shop</OPTION>"; > > echo "<OPTION VALUE='locker'>Put into my Footlocker</OPTION>"; > > echo "<OPTION VALUE='discard'>Discard this item</OPTION>"; > > echo "<OPTION VALUE='donate'>Donate this item</OPTION>"; > > echo "</SELECT>"; > > echo "<INPUT TYPE='submit' VALUE='Submit' NAME='submit'>"; > > echo "</FORM>"; > > > > > > } > > > > Jennifer > > > > > > > > --- > > Outgoing mail is certified Virus Free. > > Checked by AVG anti-virus system (http://www.grisoft.com). > > Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002 > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php