/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Select option values

I’m populating all my categories in an admin panel on my products section. Something seemed to of broke lately, not sure what happened.

I use to be able to select as many categories for a particular product as I wanted and they would appear in ALL their respected categories on the front end based on what I selected in the back end admin panel.

Now they’re only populating on the site in one category no matter how many i have selected in admin. They remain highlighted in admin and the category id’s [category_id] are being passed into mysql. I’m not sure why it’s not reflecting on the website though. Any help would be greatly appreciated. Here’s some code:

[CODE]<?

$strParent=makeParentList();

if ($strParent!=””)

$sqlCategory=”select * from “.TABLE_CATEGORY.” where category_id not in(“.$strParent.”)”;

else

$sqlCategory=”select * from “.TABLE_CATEGORY.” order by category_id”;

$exeCategory = mysql_query($sqlCategory) or die(mysql_error());

$arrCategoryId=explode(“,”,$member_row[‘category_id’]);

?>

<!–select name=”category_id[]” id=”category_id” style=”width:140px;” onchange=”fill_list(this.value)” multiple–>

<select name=”category_id[]” id=”category_id” style=”width:140px;” multiple>

<option value=””>Select</option>

<? while($rsCategory = mysql_fetch_array($exeCategory)){ ?>

<option value=”<?=$rsCategory[‘category_id’]?>” <? if(in_array($rsCategory[‘category_id’],$arrCategoryId)) echo “selected”;?> title=”<?=stripslashes($rsCategory[‘category_name’]);?>”>

<?=stripslashes($rsCategory[‘category_name’]);?>
</option>

<? }?>[/CODE]

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@SupplementauthorNov 03.2011 — [CODE]if($_POST['mode']=="edit_product"){
$category_id_arr=$_POST['category_id'];
$category_id_comma_separated="";
foreach($category_id_arr as $c)
$category_id_comma_separated.=",".$c;
$category_id_comma_separated=substr($category_id_comma_separated,1);}
[/CODE]



I hope I was able to clearly convey what was wrong.
×

Success!

Help @Supplement spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...