Dan13071992
01-27-2012, 09:38 PM
hi guys, basically, what I have is a help desk system, its got javascript in it to change feilds and select different radio buttons, my question is, as the extra feilds change depending on the catagory the user chooses, what would be the best way to add that extra feild to the database, as i dont think it would be very benificial to create a lot of different coloumns for each extra feild, and I think that would be a lot of coding just to insert it into the database, I will post the actual code for the system below and you can veiw a live html/javascript display page of it at the link listed below the code.
<td width=99% background="http://www.bootleggers.us/game-new/site/innerbg.gif" bgcolor="#222222" valign=top>
<br>
<center>
<table border="0" cellspacing="0" cellpadding="10" width="100%" class="cat">
<tr>
<td>
<p style="font-size: 4pt;"> </p>
<table border=0 cellpadding=2 cellspacing=0 width=75% align=center>
<tr>
<td width=52% valign=top class="insideTables">
<form action="/helpdesk.php" method=POST>
<table border=1 cellpadding=2 cellspacing=0 width=100% bordercolor=black class=sub2 align=center>
<tr>
<td colspan=3 class=header>Create a help ticket</td>
</tr>
<tr>
<td style="width: 30%;">Category:</td>
<td style="width: 70%;"><select name=cat id=selCat style="width: 100%;" onChange="document.getElementById('td_1').innerHTML=(null==topic[document.getElementById('selCat').value]['1']?'Field 1':topic[document.getElementById('selCat').value]['1'])+':'; document.getElementById('tr_1').style.display=(null==topic[document.getElementById('selCat').value]['1']?'none':(document.all?'':'table-row')); document.getElementById('td_2').innerHTML=(null==topic[document.getElementById('selCat').value]['2']?'Field 2':topic[document.getElementById('selCat').value]['2'])+':'; document.getElementById('tr_2').style.display=(null==topic[document.getElementById('selCat').value]['2']?'none':(document.all?'':'table-row')); document.getElementById('td_3').innerHTML=(null==topic[document.getElementById('selCat').value]['3']?'Field 3':topic[document.getElementById('selCat').value]['3'])+':'; document.getElementById('tr_3').style.display=(null==topic[document.getElementById('selCat').value]['3']?'none':(document.all?'':'table-row')); document.getElementById('tr_3a').style.display=(null==topic[document.getElementById('selCat').value]['3']?'none':(document.all?'':'table-row')); if (document.getElementById('selCat').value == 0) { document.getElementById('data_4a').disabled=false; document.getElementById('data_4a').checked=true; document.getElementById('tr_4').style.display='none'; }; if (topic[document.getElementById('selCat').value]['0'] > 0) { document.getElementById('data_4b').checked=true; document.getElementById('data_4a').disabled=true; document.getElementById('tr_4').style.display=(document.all?'':'table-row'); }; if (topic[document.getElementById('selCat').value]['0'] == 0) { document.getElementById('data_4a').disabled=false; document.getElementById('data_4a').checked=true; document.getElementById('tr_4').style.display=(document.all?'':'table-row'); }; return true;"><option value=0 id=opt_0 selected>--- Choose category ---</option><option value=6 id=opt_6>Arm Wrestling</option><option value=4 id=opt_4>Auto Burglary</option><option value=10 id=opt_10>Bank</option><option value=27 id=opt_27>Bootleggers Bootcast</option><option value=9 id=opt_9>Bootleggers Buzz</option><option value=16 id=opt_16>Bootlegging / Booze Runs</option><option value=2 id=opt_2>Casino / Poker</option><option value=24 id=opt_24>Crew Issues</option><option value=3 id=opt_3>Crimes</option><option value=25 id=opt_25>Escrow</option><option value=29 id=opt_29>Establishment</option><option value=15 id=opt_15>Feature Suggestion</option><option value=23 id=opt_23>Forums</option><option value=7 id=opt_7>General Game Play</option><option value=26 id=opt_26>Hacked!</option><option value=13 id=opt_13>Help Desk</option><option value=8 id=opt_8>Jail</option><option value=12 id=opt_12>Missions</option><option value=1 id=opt_1>Organized Crime</option><option value=17 id=opt_17>Other / Miscellaneous</option><option value=28 id=opt_28>Photo Album</option><option value=14 id=opt_14>Points Purchase</option><option value=30 id=opt_30>Problem with Staff / HDO</option><option value=20 id=opt_20>Report a Dupe</option><option value=21 id=opt_21>Report Bug / Glitch</option><option value=22 id=opt_22>Report Exploit / Cheat</option><option value=19 id=opt_19>Report Forum Infraction</option><option value=11 id=opt_11>Report TOS Violation</option><option value=5 id=opt_5>Stock Market</option><option value=18 id=opt_18>TOS / Rules Question</option></select></td>
</tr>
<tr id=tr_1 style="display: none;">
<td id=td_1 style="vertical-align: top; white-space: nowrap;">Field 1</td>
<td><input type=text name=data_1 style="width: 100%;" value=""></td>
</tr>
<tr id=tr_2 style="display: none;"><td id=td_2 style="vertical-align: top; white-space: nowrap;">Field 2</td><td><input type=text name=data_2 style="width: 100%;" value=""></td></tr>
<tr id=tr_3 style="display: none;"><td colspan=2 id=td_3 style="vertical-align: top; white-space: nowrap;">Field 3</td></tr>
<tr id=tr_3a style="display: none;"><td colspan=2 style="vertical-align: top; white-space: nowrap;"><textarea name=data_3 style="width: 100%; height: 200px;"></textarea></td></tr>
<tr id=tr_4 style="display: none;"><td><input type=radio name=data_4 id=data_4a value=0 checked> <label for=data_4a>Let HDOs help</label><br><input type=radio name=data_4 id=data_4b value=1> <label for=data_4b>Elite Guard only</label></td><td align=right><input type=submit value="Submit ticket!"></td></tr>
</table></span>
<script type="text/javascript">
var topic = new Array();
topic['0']=new Array();
topic['0']['0']=0;
topic['0']['1']=null;
topic['0']['2']=null;
topic['0']['3']=null;
topic['6']=new Array();
topic['6']['0']=0;
topic['6']['1']=null;
topic['6']['2']='Level';
topic['6']['3']='Question';
topic['4']=new Array();
topic['4']['0']=0;
topic['4']['1']=null;
topic['4']['2']='Plate';
topic['4']['3']='Question';
topic['10']=new Array();
topic['10']['0']=0;
topic['10']['1']=null;
topic['10']['2']=null;
topic['10']['3']='Question';
topic['27']=new Array();
topic['27']['0']=0;
topic['27']['1']=null;
topic['27']['2']=null;
topic['27']['3']='Question';
topic['9']=new Array();
topic['9']['0']=0;
topic['9']['1']='Issue';
topic['9']['2']=null;
topic['9']['3']='Question';
topic['16']=new Array();
topic['16']['0']=0;
topic['16']['1']=null;
topic['16']['2']=null;
topic['16']['3']='Question';
topic['2']=new Array();
topic['2']['0']=0;
topic['2']['1']=null;
topic['2']['2']=null;
topic['2']['3']='Question';
topic['24']=new Array();
topic['24']['0']=0;
topic['24']['1']=null;
topic['24']['2']='Crew';
topic['24']['3']='Question';
topic['3']=new Array();
topic['3']['0']=0;
topic['3']['1']=null;
topic['3']['2']=null;
topic['3']['3']='Question';
topic['25']=new Array();
topic['25']['0']=0;
topic['25']['1']=null;
topic['25']['2']=null;
topic['25']['3']='Question';
topic['29']=new Array();
topic['29']['0']=0;
topic['29']['1']=null;
topic['29']['2']='State';
topic['29']['3']='Question';
topic['15']=new Array();
topic['15']['0']=1;
topic['15']['1']=null;
topic['15']['2']='Feature';
topic['15']['3']='Suggestion';
topic['23']=new Array();
topic['23']['0']=0;
topic['23']['1']=null;
topic['23']['2']='Forum';
topic['23']['3']='Question';
topic['7']=new Array();
topic['7']['0']=0;
topic['7']['1']=null;
topic['7']['2']=null;
topic['7']['3']='Question';
topic['26']=new Array();
topic['26']['0']=1;
topic['26']['1']=null;
topic['26']['2']='Who hacked you?';
topic['26']['3']='Information';
topic['13']=new Array();
topic['13']['0']=0;
topic['13']['1']=null;
topic['13']['2']=null;
topic['13']['3']='Question';
topic['8']=new Array();
topic['8']['0']=0;
topic['8']['1']=null;
topic['8']['2']='State';
topic['8']['3']='Question';
topic['12']=new Array();
topic['12']['0']=0;
topic['12']['1']='Mission';
topic['12']['2']=null;
topic['12']['3']='Question';
topic['1']=new Array();
topic['1']['0']=0;
topic['1']['1']=null;
topic['1']['2']=null;
topic['1']['3']='Question';
topic['17']=new Array();
topic['17']['0']=0;
topic['17']['1']=null;
topic['17']['2']='Feature';
topic['17']['3']='Question';
topic['28']=new Array();
topic['28']['0']=0;
topic['28']['1']=null;
topic['28']['2']=null;
topic['28']['3']='Question';
topic['14']=new Array();
topic['14']['0']=5;
topic['14']['1']=null;
topic['14']['2']='Tranction ID';
topic['14']['3']='Question';
topic['30']=new Array();
topic['30']['0']=4;
topic['30']['1']=null;
topic['30']['2']='Admin/Mod/HDO Name';
topic['30']['3']='Information';
topic['20']=new Array();
topic['20']['0']=1;
topic['20']['1']=null;
topic['20']['2']='Username';
topic['20']['3']='Information';
topic['21']=new Array();
topic['21']['0']=1;
topic['21']['1']=null;
topic['21']['2']='Feature/Page';
topic['21']['3']='Information';
topic['22']=new Array();
topic['22']['0']=1;
topic['22']['1']=null;
topic['22']['2']='Feature/Page';
topic['22']['3']='Information';
topic['19']=new Array();
topic['19']['0']=0;
topic['19']['1']='Username';
topic['19']['2']='Link to Topic';
topic['19']['3']='Information';
topic['11']=new Array();
topic['11']['0']=1;
topic['11']['1']=null;
topic['11']['2']='Username';
topic['11']['3']='Information';
topic['5']=new Array();
topic['5']['0']=0;
topic['5']['1']=null;
topic['5']['2']='Company';
topic['5']['3']='Question';
topic['18']=new Array();
topic['18']['0']=0;
topic['18']['1']=null;
topic['18']['2']=null;
topic['18']['3']='Question';
</script>
</form>
</td>
<td width=3%> </td><td width=45% valign=top class="insideTables"><table border=1 cellpadding=2 cellspacing=0 width=100% bordercolor=black class=sub2 align=center><tr><td colspan=3 class=header>Help Desk Operators</td></tr></table></td></tr></table></span>
</tr>
</table>
</td>
http://crimewave.360-tactics.co.uk/hdtest.php
if you look at the link, and change the drop down box, it will display new feilds, whats the best way to place them into a database, instead of in different coloumns?
cheers guys
<td width=99% background="http://www.bootleggers.us/game-new/site/innerbg.gif" bgcolor="#222222" valign=top>
<br>
<center>
<table border="0" cellspacing="0" cellpadding="10" width="100%" class="cat">
<tr>
<td>
<p style="font-size: 4pt;"> </p>
<table border=0 cellpadding=2 cellspacing=0 width=75% align=center>
<tr>
<td width=52% valign=top class="insideTables">
<form action="/helpdesk.php" method=POST>
<table border=1 cellpadding=2 cellspacing=0 width=100% bordercolor=black class=sub2 align=center>
<tr>
<td colspan=3 class=header>Create a help ticket</td>
</tr>
<tr>
<td style="width: 30%;">Category:</td>
<td style="width: 70%;"><select name=cat id=selCat style="width: 100%;" onChange="document.getElementById('td_1').innerHTML=(null==topic[document.getElementById('selCat').value]['1']?'Field 1':topic[document.getElementById('selCat').value]['1'])+':'; document.getElementById('tr_1').style.display=(null==topic[document.getElementById('selCat').value]['1']?'none':(document.all?'':'table-row')); document.getElementById('td_2').innerHTML=(null==topic[document.getElementById('selCat').value]['2']?'Field 2':topic[document.getElementById('selCat').value]['2'])+':'; document.getElementById('tr_2').style.display=(null==topic[document.getElementById('selCat').value]['2']?'none':(document.all?'':'table-row')); document.getElementById('td_3').innerHTML=(null==topic[document.getElementById('selCat').value]['3']?'Field 3':topic[document.getElementById('selCat').value]['3'])+':'; document.getElementById('tr_3').style.display=(null==topic[document.getElementById('selCat').value]['3']?'none':(document.all?'':'table-row')); document.getElementById('tr_3a').style.display=(null==topic[document.getElementById('selCat').value]['3']?'none':(document.all?'':'table-row')); if (document.getElementById('selCat').value == 0) { document.getElementById('data_4a').disabled=false; document.getElementById('data_4a').checked=true; document.getElementById('tr_4').style.display='none'; }; if (topic[document.getElementById('selCat').value]['0'] > 0) { document.getElementById('data_4b').checked=true; document.getElementById('data_4a').disabled=true; document.getElementById('tr_4').style.display=(document.all?'':'table-row'); }; if (topic[document.getElementById('selCat').value]['0'] == 0) { document.getElementById('data_4a').disabled=false; document.getElementById('data_4a').checked=true; document.getElementById('tr_4').style.display=(document.all?'':'table-row'); }; return true;"><option value=0 id=opt_0 selected>--- Choose category ---</option><option value=6 id=opt_6>Arm Wrestling</option><option value=4 id=opt_4>Auto Burglary</option><option value=10 id=opt_10>Bank</option><option value=27 id=opt_27>Bootleggers Bootcast</option><option value=9 id=opt_9>Bootleggers Buzz</option><option value=16 id=opt_16>Bootlegging / Booze Runs</option><option value=2 id=opt_2>Casino / Poker</option><option value=24 id=opt_24>Crew Issues</option><option value=3 id=opt_3>Crimes</option><option value=25 id=opt_25>Escrow</option><option value=29 id=opt_29>Establishment</option><option value=15 id=opt_15>Feature Suggestion</option><option value=23 id=opt_23>Forums</option><option value=7 id=opt_7>General Game Play</option><option value=26 id=opt_26>Hacked!</option><option value=13 id=opt_13>Help Desk</option><option value=8 id=opt_8>Jail</option><option value=12 id=opt_12>Missions</option><option value=1 id=opt_1>Organized Crime</option><option value=17 id=opt_17>Other / Miscellaneous</option><option value=28 id=opt_28>Photo Album</option><option value=14 id=opt_14>Points Purchase</option><option value=30 id=opt_30>Problem with Staff / HDO</option><option value=20 id=opt_20>Report a Dupe</option><option value=21 id=opt_21>Report Bug / Glitch</option><option value=22 id=opt_22>Report Exploit / Cheat</option><option value=19 id=opt_19>Report Forum Infraction</option><option value=11 id=opt_11>Report TOS Violation</option><option value=5 id=opt_5>Stock Market</option><option value=18 id=opt_18>TOS / Rules Question</option></select></td>
</tr>
<tr id=tr_1 style="display: none;">
<td id=td_1 style="vertical-align: top; white-space: nowrap;">Field 1</td>
<td><input type=text name=data_1 style="width: 100%;" value=""></td>
</tr>
<tr id=tr_2 style="display: none;"><td id=td_2 style="vertical-align: top; white-space: nowrap;">Field 2</td><td><input type=text name=data_2 style="width: 100%;" value=""></td></tr>
<tr id=tr_3 style="display: none;"><td colspan=2 id=td_3 style="vertical-align: top; white-space: nowrap;">Field 3</td></tr>
<tr id=tr_3a style="display: none;"><td colspan=2 style="vertical-align: top; white-space: nowrap;"><textarea name=data_3 style="width: 100%; height: 200px;"></textarea></td></tr>
<tr id=tr_4 style="display: none;"><td><input type=radio name=data_4 id=data_4a value=0 checked> <label for=data_4a>Let HDOs help</label><br><input type=radio name=data_4 id=data_4b value=1> <label for=data_4b>Elite Guard only</label></td><td align=right><input type=submit value="Submit ticket!"></td></tr>
</table></span>
<script type="text/javascript">
var topic = new Array();
topic['0']=new Array();
topic['0']['0']=0;
topic['0']['1']=null;
topic['0']['2']=null;
topic['0']['3']=null;
topic['6']=new Array();
topic['6']['0']=0;
topic['6']['1']=null;
topic['6']['2']='Level';
topic['6']['3']='Question';
topic['4']=new Array();
topic['4']['0']=0;
topic['4']['1']=null;
topic['4']['2']='Plate';
topic['4']['3']='Question';
topic['10']=new Array();
topic['10']['0']=0;
topic['10']['1']=null;
topic['10']['2']=null;
topic['10']['3']='Question';
topic['27']=new Array();
topic['27']['0']=0;
topic['27']['1']=null;
topic['27']['2']=null;
topic['27']['3']='Question';
topic['9']=new Array();
topic['9']['0']=0;
topic['9']['1']='Issue';
topic['9']['2']=null;
topic['9']['3']='Question';
topic['16']=new Array();
topic['16']['0']=0;
topic['16']['1']=null;
topic['16']['2']=null;
topic['16']['3']='Question';
topic['2']=new Array();
topic['2']['0']=0;
topic['2']['1']=null;
topic['2']['2']=null;
topic['2']['3']='Question';
topic['24']=new Array();
topic['24']['0']=0;
topic['24']['1']=null;
topic['24']['2']='Crew';
topic['24']['3']='Question';
topic['3']=new Array();
topic['3']['0']=0;
topic['3']['1']=null;
topic['3']['2']=null;
topic['3']['3']='Question';
topic['25']=new Array();
topic['25']['0']=0;
topic['25']['1']=null;
topic['25']['2']=null;
topic['25']['3']='Question';
topic['29']=new Array();
topic['29']['0']=0;
topic['29']['1']=null;
topic['29']['2']='State';
topic['29']['3']='Question';
topic['15']=new Array();
topic['15']['0']=1;
topic['15']['1']=null;
topic['15']['2']='Feature';
topic['15']['3']='Suggestion';
topic['23']=new Array();
topic['23']['0']=0;
topic['23']['1']=null;
topic['23']['2']='Forum';
topic['23']['3']='Question';
topic['7']=new Array();
topic['7']['0']=0;
topic['7']['1']=null;
topic['7']['2']=null;
topic['7']['3']='Question';
topic['26']=new Array();
topic['26']['0']=1;
topic['26']['1']=null;
topic['26']['2']='Who hacked you?';
topic['26']['3']='Information';
topic['13']=new Array();
topic['13']['0']=0;
topic['13']['1']=null;
topic['13']['2']=null;
topic['13']['3']='Question';
topic['8']=new Array();
topic['8']['0']=0;
topic['8']['1']=null;
topic['8']['2']='State';
topic['8']['3']='Question';
topic['12']=new Array();
topic['12']['0']=0;
topic['12']['1']='Mission';
topic['12']['2']=null;
topic['12']['3']='Question';
topic['1']=new Array();
topic['1']['0']=0;
topic['1']['1']=null;
topic['1']['2']=null;
topic['1']['3']='Question';
topic['17']=new Array();
topic['17']['0']=0;
topic['17']['1']=null;
topic['17']['2']='Feature';
topic['17']['3']='Question';
topic['28']=new Array();
topic['28']['0']=0;
topic['28']['1']=null;
topic['28']['2']=null;
topic['28']['3']='Question';
topic['14']=new Array();
topic['14']['0']=5;
topic['14']['1']=null;
topic['14']['2']='Tranction ID';
topic['14']['3']='Question';
topic['30']=new Array();
topic['30']['0']=4;
topic['30']['1']=null;
topic['30']['2']='Admin/Mod/HDO Name';
topic['30']['3']='Information';
topic['20']=new Array();
topic['20']['0']=1;
topic['20']['1']=null;
topic['20']['2']='Username';
topic['20']['3']='Information';
topic['21']=new Array();
topic['21']['0']=1;
topic['21']['1']=null;
topic['21']['2']='Feature/Page';
topic['21']['3']='Information';
topic['22']=new Array();
topic['22']['0']=1;
topic['22']['1']=null;
topic['22']['2']='Feature/Page';
topic['22']['3']='Information';
topic['19']=new Array();
topic['19']['0']=0;
topic['19']['1']='Username';
topic['19']['2']='Link to Topic';
topic['19']['3']='Information';
topic['11']=new Array();
topic['11']['0']=1;
topic['11']['1']=null;
topic['11']['2']='Username';
topic['11']['3']='Information';
topic['5']=new Array();
topic['5']['0']=0;
topic['5']['1']=null;
topic['5']['2']='Company';
topic['5']['3']='Question';
topic['18']=new Array();
topic['18']['0']=0;
topic['18']['1']=null;
topic['18']['2']=null;
topic['18']['3']='Question';
</script>
</form>
</td>
<td width=3%> </td><td width=45% valign=top class="insideTables"><table border=1 cellpadding=2 cellspacing=0 width=100% bordercolor=black class=sub2 align=center><tr><td colspan=3 class=header>Help Desk Operators</td></tr></table></td></tr></table></span>
</tr>
</table>
</td>
http://crimewave.360-tactics.co.uk/hdtest.php
if you look at the link, and change the drop down box, it will display new feilds, whats the best way to place them into a database, instead of in different coloumns?
cheers guys