Hello,i m newer to the php.
my problem is...
i have one form with textfield and multiple selection listbox. i select multiple values form listbox, implode it with comma and put all values in single database field. its working.
But, i cant retrieve them with explode function . i want to put all array's values in listbox , but with selected, so that the user can get an idea about previous selection.
Could anyone please help me?
Pooja J. 0 Light Poster
Recommended Answers
Jump to PostFollowing code may help you
<html> <body> <form> <!-- copy following php code at the place where you are populating your list box--> <?php /* set $mywholearray from database this array contains all master values to be shown in listbox $mywholearray[0]['id']='pkvalue', $mywholearray[0]['desc']='description', */ /*set $myselarray from database …
Jump to Post<? $cat=$city; //fetch $city according to ur query. $catrr=explode(",",$cat); //explode. //echo $catrr; ?> <select name="t_city[]" size="5" multiple="multiple" class="normal_text" id="t_class" style="width: 150px;"> <? if(!$_SESSION[user]) { ?> <option selected="selected" value="select">Select Class</option> <? } ?> <? $cat_query=mysql_query("select * from city "); while($cat_data=mysql_fetch_array($cat_query)) { ?> <option value="<?=$cat_data['city'] ?>"<?if(in_array($cat_data['city'],$catrr)) {?> selected="selected" <? …
Jump to PostI am not exploding $one and using our own code with minor changes. I am only changing condition and echoing only selected instead of selected="selected"
<body> <select name="city[]" size=5 multiple="multiple"> <option value="pune"<?php if (substr_count($one, 'pune') > 0 ) { echo 'selected'; } ?>>pune</option> <option value="mumbai"<?php if (substr_count($one, …
All 10 Replies
urtrivedi 276 Nearly a Posting Virtuoso
Pooja J. 0 Light Poster
pushpakalpana 1 Newbie Poster
muralibobby2015 17 Posting Pro
Pooja J. 0 Light Poster
muralibobby2015 17 Posting Pro
Pooja J. 0 Light Poster
muralibobby2015 17 Posting Pro
rajabhaskar525 1 Junior Poster
urtrivedi 276 Nearly a Posting Virtuoso
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.