I am working on a module for my website. the module is to allow people to create groups and invite people to them.
I am currently working on the visual aspect of how the group tags will be selected
there is a text field for the name and multiple drop down lists for inserting image entries into the database.
I want to make a button for disabling and enabling different drop down windows.
My problem is I already have an id for the drop down menu so it will insert the values to mysql
But i need another id from what I can see for each drop list to be able to specify one to disable or enable.
Is there a way I can disable and enable different drop down windows that already have an id, which I need to keep?
I can’t just rename to the other ID, because I need multiple ids for each drop down so I can disable them when needed.
HERE IS MY CODE FOR THE MODULE:
[code=php]<html>
<head>
<script type=”text/javascript”>
function makeDisable(){
var x=document.getElementById(“tag_border”)
x.black_border_tech.disabled=true;
}
function makeEnable(){
var x=document.getElementById(“tag_border”)
x.black_border_tech.disabled=false;
}
</script>
<?php
class module extends forum
{
public function view()
{
global $logon;
if($logon->online) {
$q = mysql_query(“SELECT group_id FROM gamezove_deciet.account_info WHERE user = ‘”.$logon->username.”‘”, $this->c);
$r = mysql_fetch_assoc($q);
$groupquery = mysql_query(“SELECT * FROM gamezove_deciet.groups WHERE `leader_name`='” . $logon->username . “‘”, $this->c);
$groupreturn = mysql_fetch_assoc($groupquery);
//group variables
$groupname = $groupreturn[‘name’];
$groupbg = $groupreturn[‘bg’];
$groupborder = $groupreturn[‘border’];
$groupdecal = $groupreturn[‘decal’];
//group id from account_info table
$group = $r [‘group_id’];
if (!empty($group))
{
$groups = ‘<div class=”stacking” style=”margin-left: -9px;”>
<img src=”images/tags/’ .$groupbg. ‘”style=”margin-right: -165px;”/>
<img src=”images/tags/’ .$groupborder. ‘”style=”margin-top: -90px;”/>
<img src=”images/tags/’ .$groupdecal. ‘”style=”margin-top: -100px; margin-left: -165px; margin-top:100;”/>
<center><div class = “stacking” style=” margin-bottom:25px; margin-top:-65px; font-weight: bold; color:white; font-size:13px; text-shadow:
-1px -1px 0 #000,
1px -1px 0 #000,
-1px 1px 0 #000,
1px 1px 0 #000;
margin-bottom: 25px;”>
‘ . @$groupname. ‘
</div></center>’;
}
$out = ‘<div class=”right_box”>
<div class=”right_box_top” id=”headline”>Group Settings</div>
<div class=”right_box_body” id=”forum_spot”>
<table class=”table” width=”550px” id=”register”>
<tr>
<td style=”padding-left:20px;”>Tag Preview:</td>
<td>
‘ . @$groups. ‘
</td>
</tr>
‘;
if (empty($group))
{
$out .= ‘</table><br><center>
<input type=”button” value=”Save Tag” onClick=”saveTagSettings()” />
</center><br /><br /><div id=”ajax_spot” style=”text-align:center;”></div>
<input type=”text” id=”tag_name” value=”” maxlength=”15″/><div>
Background Color:<select id=”tag_bg”>
<option>Choose Color</option>
<option value=”BG_Black.png”>Black</option>
<option value=”BG_DBlue.png”>Dark Blue</option>
<option value=”BG_LBlue.png”>Light Blue</option>
<option value=”BG_Green.png”>Green</option>
<option value=”BG_Orange.png”>Orange</option>
<option value=”BG_Pink.png”>Pink</option>
<option value=”BG_Purple.png”>Purple</option>
<option value=”BG_Red.png”>Red</option>
<option value=”BG_Yellow.png”>Yellow</option>
</select>
</div>
<div class=”clear”></div>
</div>
</div>’;
}
if (!empty($group))
{
$out .= ‘</table><br><center>
<input type=”button” value=”Update Tag” onClick=”updateTagSettings()” />
</center><br /><br /><div id=”ajax_spot” style=”text-align:center;”></div>
<center><input type=”text” id=”tag_name” value=”‘ . @$groupreturn[‘name’] . ‘” maxlength=”15″/><div>
Background:<select id=”tag_bg”>
<option>Choose Color</option>
<option value=”BG_Black.png”>Black</option>
<option value=”BG_DBlue.png”>Dark Blue</option>
<option value=”BG_LBlue.png”>Light Blue</option>
<option value=”BG_Green.png”>Green</option>
<option value=”BG_Orange.png”>Orange</option>
<option value=”BG_Pink.png”>Pink</option>
<option value=”BG_Purple.png”>Purple</option>
<option value=”BG_Red.png”>Red</option>
<option value=”BG_Yellow.png”>Yellow</option>
</select>
</div>
<div>
Border:
<select>
<option id = “black_border_tech” value=”BG_Black.png”>Black</option>
<option value=”BG_DBlue.png”>Dark Blue</option>
<option value=”BG_LBlue.png”>Light Blue</option>
<option value=”BG_Green.png”>Green</option>
<option value=”BG_Orange.png”>Orange</option>
<option value=”BG_Pink.png”>Pink</option>
<option value=”BG_Purple.png”>Purple</option>
<option value=”BG_Red.png”>Red</option>
<option value=”BG_Yellow.png”>Yellow</option>
</select>
<input type=”button” onclick=”makeDisable()” value=”Disable list”>
<input type=”button” onclick=”makeEnable()” value=”Enable list”>
</div>
</center>
<div class=”clear”></div>
</div>
</div>’;
}
return $out;
}
}
}
?>
HERE IS THE CODE FOR MY FORUM WHICH IT IS EXTENDING: I only put the part that was relevant
[code=php]
function saveTagValues() {
global $logon;
if ($logon->online) {
$tag_name= mysql_real_escape_string($_POST[‘tagname’]);
$tag_bg= mysql_real_escape_string($_POST[‘tagbg’]);
$tag_border= mysql_real_escape_string($_POST[‘tagborder’]);
$tag_decal= mysql_real_escape_string($_POST[‘tagdecal’]);
if (strlen($tag_name) > 15) {
die(“tag may not exceed 15 characters.”);
}
if (strlen($tag_name) < 1) {
die(“tag name can not be blank!”);
}
mysql_query(“INSERT INTO ” . $this->db . “.groups(`leader_name`, `name`, `bg`, `border`, `decal`) VALUES(‘” . $logon->username . “‘, ‘” . $tag_name . “‘, ‘” . $tag_bg . “‘, ‘” . $tag_border . “‘, ‘” . $tag_decal . “‘)”, $this->c) or die(“Something went wrong, please try again, or contact an admin”);
$groupquery = mysql_query(“SELECT * FROM gamezove_deciet.groups WHERE `leader_name`='” . $logon->username . “‘”, $this->c);
$groupreturn = mysql_fetch_assoc($groupquery);
$group = $groupreturn [‘id’];
mysql_query(“UPDATE gamezove_deciet.account_info SET group_id = ‘” . $group . “‘ WHERE `user`='” . $logon->username . “‘”, $this->c) or die(“Its being gay again”);
echo “Your tag have been saved!”;
}
}
function updateTagValues() {
global $logon;
$tag_name= mysql_real_escape_string($_POST[‘tagname’]);
$tag_bg= mysql_real_escape_string($_POST[‘tagbg’]);
$tag_border= mysql_real_escape_string($_POST[‘tagborder’]);
$tag_decal= mysql_real_escape_string($_POST[‘tagdecal’]);
mysql_query(“UPDATE gamezove_deciet.groups SET leader_name = ‘” . $logon->username . “‘, name='” . $tag_name . “‘, bg='” . $tag_bg . “‘, border='” . $tag_border . “‘, decal='” . $tag_decal . “‘ WHERE `leader_name`='” . $logon->username . “‘”, $this->c) or die(“Something went wrong, please try again!”);
if (strlen($password) > 0)
{
echo “Your tag have been updated!”;
if(strlen($password) > 0)
{
$logon->logout();
}
}
}
AND HERE IS MY JS FILE, I once again only put in the relevant part
[code=php]function saveTagSettings() {
var tagname = $(“#tag_name”).val()
var tagbg = $(“#tag_bg”).val()
var tagborder = $(“#tag_border”).val()
var tagdecal = $(“#tag_decal”).val()
$(“#ajax_spot”).html(“<img src=’theme/” + theme + “/images/ajax.gif’ />”)
$.post(“inc/forum_ajax.php”, { ajax: 19, tagname: tagname, tagbg: tagbg, tagborder: tagborder, tagdecal: tagdecal}, function(data) {
$(“#ajax_spot”).html(data)
});
}
function updateTagSettings() {
var tagname = $(“#tag_name”).val()
var tagbg = $(“#tag_bg”).val()
var tagborder = $(“#tag_border”).val()
var tagdecal = $(“#tag_decal”).val()
$(“#ajax_spot”).html(“<img src=’theme/” + theme + “/images/ajax.gif’ />”)
$.post(“inc/forum_ajax.php”, { ajax: 20, tagname: tagname, tagbg: tagbg, tagborder: tagborder, tagdecal: tagdecal}, function(data) {
$(“#ajax_spot”).html(data)
});
}
any help would be appreciated