Bonjour,

Merci d'avance pour votre aide. Je suis en train de créer dans ma base de donnée différentes catégories de genre musicaux avec des sous catégories qui sont identifiés avec parent_project_category_id.

Nom : project_category.jpg
Affichages : 85
Taille : 113,4 Ko


J'utilise une liste déroulante pour que l'internaute puisse faire son choix mais je ne sais pas comment créer la sous catégorie dans la liste déroulante. Pourriez vous m'aider à créer la sous catégorie dans la liste déroulante ? Tout s'affiche en colonne sans distinction des catégories et sous catégories comme vous pouvez le voir sur l image.



Voici le code de la page concernée, le tabindex est à la ligne 585. Je précise que ce n'est pas moi qui est créé le code, je suis débutant.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
<script type="text/javascript">
function LTrim( value ) {
 
	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");
 
}
 
// Removes ending whitespaces
function RTrim( value ) {
 
	var re = /((\s*\S+)*)\s*/;
	return value.replace(re, "$1");
 
}
 
// Removes leading and ending whitespaces
function trim( value ) {
 
	return LTrim(RTrim(value));
 
}
 
 
 
function image_valid()
{
 
	var projectimagevideoset='';
 
	var radioButtons = document.getElementsByName("projectimagevideoset");
      for (var x = 0; x < radioButtons.length; x ++) {
        if (radioButtons[x].checked) {
 
			projectimagevideoset=radioButtons[x].value;
        }
      }
 
 
	if(projectimagevideoset=='')
	{
 
			set_error('err3', "<?php echo PLEASE_SELECT_DISPLAY_PAGE; ?>");
			document.getElementById('err1').style.display='none';
			document.getElementById('err2').style.display='none';
 
	}
	else
	{
			document.getElementById('err3').style.display='none';
	}
 
 
 
		if(projectimagevideoset==0)
		{
			document.getElementById('err2').style.display='none';
			document.getElementById('err1').style.display='block';
 
 
		frmCheckform        = document.frm_project;
        // assigh the name of the checkbox;
        var chks = document.getElementsByName('file_up[]');
 
        var hasChecked = false;
        // Get the checkbox array length and iterate it to see if any of them is selected
        for (var i = 0; i < chks.length; i++)
        {
                if (chks[i].value=='')
                {
                       set_error('err1', "<?php echo IMAGE_REQUIRED;?>");
					   hasChecked = true;
                        break;
                }
				else 
				{
 
						value = chks[i].value;
						t1 = value.substring(value.lastIndexOf('.') + 1,value.length);
						if( t1=='jpg' || t1=='jpeg' || t1=='gif' || t1=='png' || t1=='JPEG' || t1=='JPG'  ||  t1=='PNG' || t1=='GIF')
						{
							document.getElementById('err1').style.display='none';
						}
						else
						{						
							set_error('err1', "<?php echo IMAGE_TYPE_NOT_VALID; ?>");	
							hasChecked = true;
                      		break;
						}
 
 
 
				}
 
        }
 
 
 
		}
 
 
 
		if(projectimagevideoset==1)
		{		
				document.getElementById('err1').style.display='none';
				document.getElementById('err2').style.display='block';
 
				if(document.getElementById('video_set').value==1)
				{
 
							if(document.getElementById('videofile').value == "")
							{
								i=0;
								set_error('err2', "<?php echo VIDEO_REQUIRED; ?>");
							}else{
								value = document.getElementById('videofile').value;
								t1 = value.substring(value.lastIndexOf('.') + 1,value.length);
								if( t1=='avi' || t1=='mp3' || t1=='flv' || t1=='AVI' || t1=='MP3' || t1=='FLV'){
								}else{
								i=0;
								set_error('err2', "<?php  echo VIDEO_TYPE_NOT_VALID;?>");
								}
							}
				}
 
 
				if(document.getElementById('video_set').value==0)
				{
 
 
							if(document.getElementById('video').value == "")
							{
								set_error('err2', "<?php echo VIDEO_URL_REQUIRED; ?>");
							}else{
 
							}
 
				}
 
		}
 
 
 
}
 
 
 
function set_error(ele,msg)
{
var dv = document.getElementById(ele);
dv.className = "error";
dv.style.clear = "both";
dv.style.minWidth = "110px";
dv.style.margin = "5px";
dv.style.display='block';
dv.innerHTML = msg;
 
}
 
 
 
 
 
 
function submit_image_valid()
{
 
	var check=true;
 
 
	var projectimagevideoset='';
 
	var radioButtons = document.getElementsByName("projectimagevideoset");
      for (var x = 0; x < radioButtons.length; x ++) {
        if (radioButtons[x].checked) {
 
			projectimagevideoset=radioButtons[x].value;
        }
      }
 
 
	if(projectimagevideoset=='')
	{
 
			check=false;
			var dv = document.getElementById('err3');
			dv.className = "error";
			dv.style.clear = "both";
			dv.style.minWidth = "110px";
			dv.style.margin = "5px";
			dv.innerHTML = "<?php echo PLSEASE_SELECT_DISPLAY_PAGE; ?>";
			return false;
 
	}
	else
	{
		document.getElementById('err3').style.display='none';
	}
 
 
 
		if(projectimagevideoset==0)
		{
			document.getElementById('err2').style.display='none';
			document.getElementById('err1').style.display='block';
 
 
 
 
		frmCheckform        = document.frm_project;
        // assigh the name of the checkbox;
        var chks = document.getElementsByName('file_up[]');
 
        var hasChecked = false;
        // Get the checkbox array length and iterate it to see if any of them is selected
        for (var i = 0; i < chks.length; i++)
        {
                if (chks[i].value=='')
                {
                        check=false;
						var dv = document.getElementById('err1');
						dv.className = "error";
						dv.style.clear = "both";
						dv.style.minWidth = "110px";
						dv.style.margin = "5px";
						dv.innerHTML = "<?php echo IMAGE_REQUIRED; ?>";
						dv.style.display='block';
 
					  	hasChecked = true;
 
						return false;
                }
				else 
				{
 
						value = chks[i].value;
						t1 = value.substring(value.lastIndexOf('.') + 1,value.length);
						if( t1=='jpg' || t1=='jpeg' || t1=='gif' || t1=='png' || t1=='JPEG' || t1=='JPG'  ||  t1=='PNG' || t1=='GIF')
						{
							document.getElementById('err1').style.display='none';
							check=true;
						}
						else
						{						
 
 
							check=false;
							i=0;
							var dv = document.getElementById('err1');
 
							dv.className = "error";
							dv.style.clear = "both";
							dv.style.minWidth = "110px";
							dv.style.margin = "5px";
							dv.innerHTML = "<?php echo IMAGE_TYPE_NOT_VALID; ?>";
							dv.style.display='block';
							hasChecked = true;
 
							return false;
 
 
 
 
						}
 
 
 
				}
 
        }
 
 
 
		}
 
 
		if(projectimagevideoset==1)
		{	 
			 document.getElementById('err1').style.display='none';
			 document.getElementById('err2').style.display='block';
 
			 if(document.getElementById('video_set').value==1)
				{
 
							if(document.getElementById('videofile').value == "")
							{
								check=false;
								i=0;												
								var dv = document.getElementById('err2');
								dv.className = "error";
								dv.style.clear = "both";
								dv.style.minWidth = "110px";
								dv.style.margin = "5px";
								dv.innerHTML = "<?php echo VIDEO_REQUIRED; ?>";
								return false;	
 
 
							}else{
								value = document.getElementById('videofile').value;
								t1 = value.substring(value.lastIndexOf('.') + 1,value.length);
								if( t1=='avi' || t1=='mp3' || t1=='flv' || t1=='AVI' || t1=='MP3' || t1=='FLV'){
 
								check=true;
 
								}else{
 
								check=false;
								i=0;												
								var dv = document.getElementById('err2');
								dv.className = "error";
								dv.style.clear = "both";
								dv.style.minWidth = "110px";
								dv.style.margin = "5px";
								dv.innerHTML = "<?php echo VIDEO_TYPE_NOT_VALID; ?>";
								return false;	
								}
							}
				}
 
 
				if(document.getElementById('video_set').value==0)
				{
 
 
							if(document.getElementById('video').value == "")
							{
								check=false;
								i=0;												
								var dv = document.getElementById('err2');
								dv.className = "error";
								dv.style.clear = "both";
								dv.style.minWidth = "110px";
								dv.style.margin = "5px";
								dv.innerHTML =   "<?php echo VIDEO_URL_REQUIRED; ?>";
								return false;	
 
							}else{
 
								check=true;
 
							}
 
				}
 
 
		}
 
 
 
		if(check==true)
		{
			document.frm_project.submit();
		}
 
 
 
 
}
 
 
 
function limitText(limitField, limitCount, limitNum) {
 
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} else {
		limitCount.value = limitNum - limitField.value.length;
	}
}
 
 
 
 
function removeHTMLTags(str){
 
 		var strInputCode = str;
 		/* 
  			This line is optional, it replaces escaped brackets with real ones, 
  			i.e. < is replaced with < and > is replaced with >
 		*/	
 	 	strInputCode = strInputCode.replace(/&(lt|gt);/g, function (strMatch, p1){
 		 	return (p1 == "lt")? "<" : ">";
 		});
 		var strTagStrippedText = strInputCode.replace(/<\/?[^>]+(>|$)/g, "");
 		return strTagStrippedText;	
   // Use the alert below if you want to show the input and the output text
   //		alert("Input code:\n" + strInputCode + "\n\nOutput text:\n" + strTagStrippedText);	
 
}
 
 
function set_category(id,disp_id){
	document.getElementById(id).disabled = true;
	document.getElementById(disp_id).disabled = false;
}
</script>
<script type="text/javascript" src="<?php echo base_url(); ?>js/form_effort.js"></script>
 
 
 
<!--<script type="text/javascript" src="<?php //echo base_url(); ?>js/jquery.min.js"></script>
 
<script type="text/javascript" src="<?php //echo base_url(); ?>js2/date.js"></script> 
<script type="text/javascript" src="<?php //echo base_url(); ?>js2/jquery.datePicker.js"></script>
 
<link href="<?php //echo base_url(); ?>js2/datePicker.css" rel="stylesheet" />
<script type="text/javascript" charset="utf-8">
Date.format = 'dd-mm-yyyy';
           jQuery(function()
            {
 
				jQuery('.date-pick').datePicker({clickInput:true})
 
            });
 
 
 
 
		</script>-->
 
 
<style type="text/css">
a.dp-choose-date {
	float: right;
	width: 16px;
	height: 16px;
	padding: 0;
	margin: 5px 237px 0px 0px;
	display: block;
	text-indent: -2000px;
	overflow: hidden;
	background: url(<?php echo base_url(); ?>js2/calendar-green.gif) no-repeat; 
}
.inner_content_two{background:#fff;}
.all_textbox{width:300px;}
.normal_label,.form-label{width:150px;}	
 
 
</style>
 
<div class="menubg">
    <div class="main">
        <div class="innerpage_heading">
            <h1 class="txtCap fl"><?php echo substr(trim($this->session->userdata('project_title')),0,52); ?></h1>
            	<?php if($this->session->userdata['project_id']!='' && $this->session->userdata['project_id']!=0) {  ?>
				<div class="fr">        
				 <?php echo anchor('project/my_project/',CHANGE_PROJECT,'class="project_title" style="border:none;color:#EC004B;"'); ?>
                </div>
           		<?php } ?> 
           <br /><br /><br/>
 
                <h5 style="float:none;"><?php echo EASILY_CREATE;?></h5>
            <div class="clear"></div>
        </div>
 
        <div class="menu">      
            <style type="text/css">
 
#tab_all a{ color:#000000; text-decoration:none; }
.radio {
width: 15px;
height: 18px;
margin: 10px 10px 0px 5px;
display: block;
clear: left;
float: left;
}
.radio {
background: url(<?php echo base_url();?>images/radio3.png) no-repeat;
}
 
</style>				
<?php
	$data['tab_sel'] = EDIT_PAGE;
	$this->load->view('overview_tabs',$data);
 
?>
 
    <div class="clear"></div>
 
    <div class="create_content">
 
 
    <?php if($error != "")
				{ ?>
                <div class="error" style="height:auto; padding:25px 0px 0px 0px;">
                <?php echo $error; ?>
                </div>
                <?php } ?>
            <img src="<?php echo base_url();?>images/step3-hover.png" width="0" height="0" border="0"/>
        	<img src="<?php echo base_url();?>images/step1-hover1.png" width="0" height="0" border="0"/>
            <img src="<?php echo base_url();?>images/step5-hover.png" width="0" height="0" border="0"/>    
 
        <ul>
 
        	<?php
				if($id!='' and $id!='0'){
			?>
                    <li id="1" class="step1 active"><a href="#"><?php echo START;?></a></li>
                    <li id="2"><a href="<?php echo site_url('edit_start_project/edit_create_step2/'.$id); ?>"><?php echo EDIT;?></a></li>
                    <li id="3"><a href="<?php echo site_url('edit_start_project/edit_create_step3/'.$id); ?>"><?php echo REWARDS;?></a></li>
                    <li id="4"><a href="<?php echo site_url('edit_start_project/edit_create_step4/'.$id); ?>"><?php echo PREVIEW;?></a></li>
                    <li id="5" class="step5"><a href="<?php echo site_url('edit_start_project/edit_create_step5/'.$id); ?>"><?php echo SUBMIT;?></a></li>
            <?php } else { ?>
 
                    <li id="1" class="step1 active"><a href="#" class="1"><?php echo START;?></a></li>
                    <li id="2" class=""><a style="cursor:auto;"><?php echo EDIT;?></a></li>
                    <li id="3" class=""><a style="cursor:auto;"><?php echo REWARDS;?></a></li>
                    <li id="4" class=""><a style="cursor:auto;"><?php echo PREVIEW;?></a></li>
                    <li id="5" class="step5"><a style="cursor:auto;"><?php echo SUBMIT;?></a></li>
 
            <?php } ?>
        </ul>
        <div class="clear"></div>
        <h6><?php echo CHOOSE_FROM;?></h6>
        <?php
				//$attributes = array('id'=>'frm_project','name'=>'frm_project','onsubmit'=>'return submit_image_valid()');
				$attributes = array('id'=>'frm_project','name'=>'frm_project');
 
 
			echo form_open_multipart('edit_start_project/edit_create_step1/'.$id, $attributes);
	  ?>
            <div class="create_left" style="float:right;">
                <div class="con1"></div>
                <div class="con2"></div>
                <div class="con3"></div>
                <div class="con4"></div>
                <?php /*
                <a href="javascript:" style="cursor:default;"  onclick="set_category('alternative_category_id','dvd_category_id');"><input type="radio" class="styled" name="project_type" id="dvdlive_project" <?php if($project_type=='1'){ echo 'checked="checked"'; } ?> value="1" /></a><h4><?php echo DVDLIVE_PROJECT;?></h4>
 
                <!--<img src="<?php echo base_url();?>images/radio.png" alt="" />
                <h4>dvdLive project</h4>-->
                <label class="all_txt"><?php echo CATEGORY_PROJECT;?></label>
                <select tabindex="4" name="category_id" id="dvd_category_id" class="all_textbox"   style="width: 265px;" <?php if($project_type!='1'){ ?> disabled="disabled" <?php } ?> >
                    <option value="" ><?php echo SELECT_CATEGORY; ?></option>
                <?php
                    foreach($dvd_category as $dc)
                    {
 
                        if($dc->project_category_id==$category_id) {
 
							if($_SESSION['lang_code'] == 'fr'){
 
								echo "<option value='".$dc->project_category_id."' selected='selected'>".$dc->project_category_name_fr."</option>";	
 
							} else {
 
                        		echo "<option value='".$dc->project_category_id."' selected='selected'>".$dc->project_category_name."</option>";
 
							}
                        }
 
                        else
                        {
							if($_SESSION['lang_code'] == 'fr'){
 
                        		echo "<option value='".$dc->project_category_id."'>".$dc->project_category_name_fr."</option>";
 
							} else {
 
								echo "<option value='".$dc->project_category_id."'>".$dc->project_category_name."</option>";
							}
 
                        }
                    }
 
                ?>
                </select>
                <div class="clear"></div>
                <p><?php echo FOR_A_DVDLIVE;?><?php echo $site_setting['currency_symbol'];?><?php echo MINIMUM;?></p>
                <p style="color:#ec004b;"><?php echo BACKERS_BECOME;?></p>
                <p>&nbsp;</p>*/?>
                <div class="clear"></div>
            </div>
 
            <div class="create_left" style="float:left;">
                <div class="con1"></div>
                <div class="con2"></div>
                <div class="con3"></div>
                <div class="con4"></div>
                <a href="javascript:" style="cursor:default;"  onclick="set_category('dvd_category_id','alternative_category_id');" ><input type="radio" class="styled" name="project_type" id="alternative_project" <?php if($project_type=='2'){ echo 'checked="checked"'; } ?> checked="checked" value="2" /></a><h4><?php echo ALTERNATIVE_PROJECT;?></h4>
                <!--<img src="<?php echo base_url();?>images/radio.png" alt="" />
                <h4>Alternative project</h4>-->
                    <label class="all_txt"><?php echo CATEGORY_PROJECT;?></label>
                    <select tabindex="4" name="category_id" id="alternative_category_id" class="all_textbox" style="width: 265px;" <?php if($project_type!='2'){ ?> disabled="disabled" <?php } ?>>
                    <option value="" ><?php echo SELECT_CATEGORY; ?></option>
                <?php
                    foreach($alternative_category as $row1)
                    {
 
                        if($row1->project_category_id==$category_id) {
 
							if($_SESSION['lang_code'] == 'fr'){
 
                        		echo "<option value='".$row1->project_category_id."' selected='selected'>".$row1->project_category_name_fr."</option>";
 
							} else {
 
								echo "<option value='".$row1->project_category_id."' selected='selected'>".$row1->project_category_name."</option>";
 
							}
                        }
 
                        else
                        {
 
							if($_SESSION['lang_code'] == 'fr'){
 
                        		echo "<option value='".$row1->project_category_id."'>".$row1->project_category_name_fr."</option>";
 
							} else {
 
								echo "<option value='".$row1->project_category_id."'>".$row1->project_category_name."</option>";
 
							}
 
                        }
                    }
 
                ?>
                </select>
                    <div class="clear"></div>
                    <p><?php echo FOR_AN_ALTERNATIVE;?></p>
                    <p><?php echo YOU_DECIDE;?></p>
                    <p style="color:#ec004b;"><?php echo FINANCIAL_COMPENSATION;?></p>
                <div class="clear"></div>
            </div>
            <div class="clear"></div>
            <div class="pink_border"></div>
 
            <input type="hidden"  name="id" id="id"  value="<?php echo $id; ?>" />
            <input type="submit"  name="next" id="next" class="back_this" border="none"  title="<?php echo NEXT; ?>" value="<?php echo NEXT; ?>&nbsp;&nbsp;>" style="border:none;float:right;" />
             <div id="err1"></div>    
			 <div id="err2"></div>   
             <div id="err3"></div>
        </form>
    </div>
</div>
 
</div>
</div>