0

hi all i have following a tutorial for a groups system for my site and if i click on groups link nothing happens if someone can see whats happening Sorry for all the lines but im stuck :(
see code below for that

php code

<?php
$thisPage = basename($_SERVER['PHP_SELF']); 
$thisGroup = ""; 
$agList = ""; 
$mgList = ""; 
$_SESSION['group'] = "notSet"; 
if ($thisPage == "group.php"){
       if(isset($_GET["g"])){
               $thisGroup = preg_replace('#[^a-z0-9_]#i', '', $_GET['g']); 
               $_SESSION['group'] = $thisGroup; 
       } 
}
if (isset($_SESSION['username'])) {
 // All groups list 
 $query = mysqli_query($db_conx, "SELECT name,logo FROM groups"); 
 $g_check = mysqli_num_rows($query); 
 if ($g_check > 0){ 
 while ($row = mysqli_fetch_array($query, MYSQLI_ASSOC)) { 
 $agList .= '<a href="group.php?g='.$row["name"].'">
 <img src="groups/'.$row["name"].'/'.$row["logo"].'" alt="'.$row["name"].'" title="'.$row["name"].'" width="50" height="50" border="0" /></a>';
 } 
 } 
  // My groups list 
 $sql = "SELECT gm.gname, gp.logo 
 FROM gmembers AS gm 
 LEFT JOIN groups AS gp ON gp.name = gm.gname 
 WHERE gm.mname = '$log_username'"; 
 $query = mysqli_query($db_conx, $sql); 
 $g_check = mysqli_num_rows($query); 
 if ($g_check > 0){ 
 while ($row = mysqli_fetch_array($query, MYSQLI_ASSOC)) { 
 $mgList .= '<a href="group.php?g='.$row['gname'].'"><img src="groups/'.$row['gname'].'/'.$row['logo'].'" alt="'.$row['gname'].'" title="'.$row['gname'].'" width="50" height="50" border="0" /></a>'; 
 } 
 } 
 }
 ?>

Then heres the html Llink section

<?php if(isset($_SESSION['username'])) { ?> 
         <a href="#"><img src="images/group3.png" alt="groups" border="0" width="25" height="15" title="Groups" onclick="return false" onmousedown="showGroups()"></a> 
         <?php } ?>

and heres the javascript section

var isShowing = "no"; 
function showGroups() {
    if(isShowing == "no"){
        _('groupModule').innerHTML = '<div id="groupWrapper"><div id="groupList"><h2>My Groups</h2><hr /><?php echo $mgList; ?>
        <h2>All Groups</h2><hr /><?php echo $agList; ?></div><div id="groupForm"><h2>Create New Group</h2><hr /><p>
        Group Name:<br /><input type="text" id="gname" onBlur="checkGname()" ><span id="gnamestatus"></span></p><p>How do people 
        join your group?<br /><select name="invite" id="invite"><option value="null" selected>&nbsp;</option><option value="1">By 
        requesting to join.</option><option value="2">By simply joining.</option></select></p><button id="newGroupBtn" 
        onClick="createGroup()">Create Group</button><span id="status"></span></div></div><div class="clear"></div>';
        isShowing = "yes";
    } else {
        _('groupModule').innerHTML = '';
        isShowing = "no";
    }
}
function checkGname(){
    var u = _("gname").value;
    var rx = new RegExp;
    rx = /[^a-z 0-9_]/gi;
    u = u.replace(rx, "");
    var rxx = new RegExp;
    rxx = /[ ]/g;
    u = u.replace(rxx, "_");

    if(u != ""){
        _("gnamestatus").innerHTML = 'checking ...';
        var ajax = ajaxObj("POST", "php_parsers/group_parser.php");
        ajax.onreadystatechange = function() {
            if(ajaxReturn(ajax) == true) {
                _("gnamestatus").innerHTML = ajax.responseText;
            }
        }
        ajax.send("gnamecheck="+u);
    }
}
function createGroup(){
    var name = _("gname").value;
    var inv = _("invite").value;
    if(name == "" || inv == "null"){
        alert("Fill all fields");
        return false;
    } else {
        status.innerHTML = 'please wait ...';
        var ajax = ajaxObj("POST", "php_parsers/group_parser.php");
        ajax.onreadystatechange = function() {
            if(ajaxReturn(ajax) == true) {
                var datArray = ajax.responseText.split("|");
                if(datArray[0] == "group_created"){
                var sid = datArray[1];
                    window.location = "group.php?g="+sid;
                } else {
                    alert(ajax.responseText);
                }
            }
        }
        ajax.send("action=new_group&name="+name+"&inv="+inv);
    }   
}
</script>
1
Contributor
1
Reply
11
Views
2 Years
Discussion Span
Last Post by janicemurby
0

just put the javascript in dreamweaver and its has a syntax error on line 7 im totally lost now

<script src="js/main.js"></script> 
<script src="js/ajax.js"></script> 
<script type="text/javascript">
var isShowing = "no"; 
function showGroups() {
    if(isShowing == "no"){
        _('groupModule').innerHTML = '<div id="groupWrapper"><div id="groupList"><h2>My Groups</h2><hr /><?php echo $mgList; ?>
        <h2>All Groups</h2><hr /><?php echo $agList; ?></div>
        <div id="groupForm"><h2>Create New Group</h2><hr /><p>
        Group Name:<br /><input type="text" id="gname" onBlur="checkGname()" ><span id="gnamestatus"></span></p><p>How do people 
        join your group?<br /><select name="invite" id="invite"><option value="null" selected>&nbsp;</option><option value="1">By 
        requesting to join.</option><option value="2">By simply joining.</option></select></p><button id="newGroupBtn" 
        onClick="createGroup()">Create Group</button><span id="status"></span></div></div><div class="clear"></div>';
        isShowing = "yes";
    } else {
        _('groupModule').innerHTML = '';
        isShowing = "no";
    }
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.