Re: Forms in PHP

From: Date: Sat, 13 Apr 2002 09:55:29 +0000
Subject: Re: Forms in PHP
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-92860@lists.php.net to get a copy of this message
In article <20020412011747.36869.qmail@pb1.pair.com>, jendowney@attbi.com says... > Hi all, > > Now I have a weird problem. I am using this code and can't understand why it > doesn't work. > When the script is run it returns a blank page, no error or done. > > here it is and any help would be appreciated. > > if(($type == book) or ($type == weapon)){ The above line is probably causing a problem. The values being compared are probably being treated as constants, as they are not enclosed in quotes. As you haven't declared the constants, there will be no match. Try if(($type == 'book') or ($type == 'weapon')){ > echo "<form action=\"$PHP_SELF\" method=\"post\">"; > echo "<SELECT NAME=\"sort\" SIZE=\"1\">"; > 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=\"Do > It!\"submit\">"; > > > > if(isset($submit)) > { > > if($sort == "shop") > { > echo "done" or die("Not!"); > } > } > } > elseif($type==food) Same problem as above > { > > echo "<SELECT NAME=\"sort\" SIZE=\"1\">"; > echo "<OPTION VALUE=\"feed\">Feed my pet</OPTION>"; > 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=\"Do it!\" > NAME=\"submit\">"; > echo "</form>"; > > > } > } > } > > Thanks for your time > Jennifer > -- David Robley Temporary Kiwi! Quod subigo farinam

« previous php.general (#92860) next »