Well, For some reason the below piece of scripture doesn't work. Can anyone see a fault within the piece? if so, please let me know. $add_item = $_POST['add_list']; $price = $_POST['price']; $anonymity = $_POST['anonymity']; $country_item = $_POST['country_item']; $location = $_POST['item_location']; if ($add_item && $country_item && $price){ if ($country_item == "Race Track" || $country_item == "Slots"){ $check_country = mysql_num_rows(mysql_query("SELECT * FROM casinos WHERE owner='$username' AND location='$location' AND casino='$country_item'")); if ($check_country == "0"){ echo "You don't own this item!"; }else{ mysql_query("UPDATE casinos SET detail='1' WHERE owner='$username' AND location='$location' AND casino='$country_item'"); $timeleft = time() + (3600 * 24 * 2); if ($anonymity == "Not Anonymous"){ mysql_query("INSERT INTO `nate_global`.`trade_center` (`id` ,`item` ,`seller` ,`price` ,`time_left` ,`item_id` ,`anonymous` ,`type`) VALUES ( '', '$country_item ($location)', '$username', '$price', '$timeleft', '$location', '0', '$country_item');"); echo "You listed a $country_item for trade!"; }elseif ($anonymity == "Anonymous"){ mysql_query("INSERT INTO `nate_global`.`trade_center` (`id` ,`item` ,`seller` ,`price` ,`time_left` ,`item_id` ,`anonymous` ,`type`) VALUES ( '', '$country_item ($location)', '$username', '$price', '$timeleft', '$location', '1', '$country_item');"); echo "You listed a $country_item for trade!"; }}}} PHP: When $country_item == "Slots" It works, but not when Race Track is the $country_item Any Help will be appreciated. Thanks, NateJ
Is the POST information URL Encoded? If so, it will not equal "Race Track". The POST value would be "Race+Track". Debug the code to make sure.
1. Try putting "echo $country_item;" after you assigned its value to see whether it comes up as "Race Track" 2. If it returns "You don't own this item!" message then it means you didn't have "Race Track" records in DB
When country_item is Race Track. Is add_item and price also set? and use isset and !empty for checking post inputs rather than a boolean check. Also clean your input.
It didn't echo the $country_item, however, The "You Don't Own this item!" message did appear, But, There is records in the database with "Race Track" Also, There may be a fault here, but i doubt it. ------------------------------------------------------------ It's come to my attention that Spaces within Option values don't work, so i've put however... if ($country_item == "Race Track" || $country_item == "Slots"){ Stops the rest of the script from executing, i've tried a few ways around this; one way being: if ($country_item == "Race Track" || $country_item == "Slots"){ Which didn't work. Anyone got alternatives?
try adding double quote to <option value="Race Track">Race Track</option> actually add it to all <option> for that matters. I guess "Bullet Factory" is not found too
no! no! <option value=Race Track>Race Track</option></select></td> WHERE is double QUOES?? be more carefull with W3C standarts!))