GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 07-Aug-2003, 06:52
zuzupus zuzupus is offline
Junior Member
 
Join Date: Jul 2003
Posts: 70
zuzupus is an unknown quantity at this point

radio button problem


hi

from one radio button on Cilck is it possible to get 3 values
as the attached image having folder jpg's but i want to use radio button in place of that so that i can use in my PHP file

thanks
Attached Images
File Type: gif modify.gif (13.4 KB, 86 views)
  #2  
Old 08-Aug-2003, 03:25
zuzupus zuzupus is offline
Junior Member
 
Join Date: Jul 2003
Posts: 70
zuzupus is an unknown quantity at this point

Re: radio button problem


i give up,plz i dont understand what to do pleas help me JdK im newbie in PHP and its very urgent
i tried to use somethign liek this initially
<input type="radio" name="ddir" onClick="FunctionName()" value="<?=$r->sys_pk ?>" id="<?="dir{$r->sys_pk}" ?>" />
<script language="javascript">
function FunctionName()
{
document.enableform.name.value='<?=htmlentities($r ->name) ?>' ;
document.enableform.check.checked=true;
document.enableform.rights.value='<?=htmlentities( $q->name) ?>' ;
}
</script>
its always show one value for DIRECTORY FIELD after selecting any radio button ,may be missiny this <?=$r->sys_pk ?>,but when i use on click= document.enableform.name.value='<?=htmlentities($r ->name) ?> in input field it works

second field is HTML information (chkbox)so when any file having HTML while it shows checked else false as there is one boolean falue in table called t_directories called info if this value is false then chkbox is unchecked else checked

third field name is Benutzer and Rechts(customers and rights )and value of this are coming fro database like
Benutzer and Rechts: BBS K.Baumgartner(these 3 names coming from database and print in this filed)
Gastzugang
BOSCH Dr Hahn

just have a look at server2.vitodesign.com then it will be clear and please modify my code and get the things to be done as im helpless dont no what to do,im pasting the code for dirmodif.phtml

thanks in advance
PHP Code:

[color=red]
<? $dir = './'; require($dir.'lib.php'); get_session(); ?>
<? // if (!$session->login || !$session->admin) send_location_die('login.phtml?error=true'); ?>
<? expire_header(); ?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
    <head>
         <title>Directory Administration</title>
         <link rel="stylesheet" type="text/css" href="../styles/styles.css" />
         <? expire(); ?>

    </head>

    <body>
         <?
              $trees = 2;
              $tree = array();
                        $users = array();
                        //$names = array();
                        $info = array();

                        //To get value for Directory Information from this querry
                        query_db("SELECT sys_pk, name FROM t_user ORDER BY name");
              while($r = foreach_db()) {
                   $users[$r->sys_pk] = $r;
              }
                        //i just commented this as i dont no how to use this value
                        //To get value for Benutzer and Rechts from this querry i dont no why it snot working

                        $ddir += 0;
              *query_db("SELECT u.name FROM t_user u INNER JOIN tr_directories_user r ON r.fk_t_user=u.sys_pk WHERE r.fk_t_directories=$ddir");
              while($q = foreach_db()) {
                   $names[$q->name] = $q;
              }
                        //SELECT info FROM `t_directories` WHERE sys_pk=470
                        //actually oi dont no how to get value in sys_pk in below querry something like SELECT info FROM `t_directories` WHERE sys_pk='???'
                        //thats why i used like this if info is false then checkbox is false and if info is true then checked
                        //actually this info is boolean
                        query_db("SELECT info FROM t_directories");
                        while($r = foreach_db()) {
                   $info[$r->sys_pk] = $r;
              }
                        // To get tree structure
              query_db("SELECT sys_pk, fk_t_directories_parent AS parent, name FROM t_directories ORDER BY sort, name");
              while($r = foreach_db())
                   $tree[$r->sys_pk] = $r;
              $top = array();
              foreach(array_keys($tree) as $key) {
                   $v =& $tree[$key];
                   if (isset($tree[$v->parent])) {
                        $tree[$v->parent]->child[] =& $v;
                   } else {
                        $top[] =& $v;
                   }
                   unset($v);
              }
              unset($tree);
              function recurse(&$tree, &$maxdepth, &$opens, &$opens_new, &$subtree, $depth) {
                   if (++$depth > $maxdepth) $maxdepth = $depth;
                   foreach($subtree as $r) {
                        $s = new stdClass();
                        $s->sys_pk = $r->sys_pk;
                        $s->depth = $depth;
                        $s->name = $r->name;
                        $children = is_array($r->child) ? count($r->child) : 0;
                        if ($children) {
                             if ($opens[$s->sys_pk]) {
                                  $s->mode = 2;
                                  $opens_new[$s->sys_pk] = true;
                             } else {
                                  $s->mode = 1;
                             }
                        } else {
                             $s->mode = 0;
                        }
                        $tree[$r->sys_pk] = $s;
                        if ($s->mode == 2)
                             recurse($tree, $maxdepth, $opens, $opens_new, $r->child, $depth);
                   }
              }
              function make_tree(&$opens) {
                   global $top;
                   $tree = array();
                   $maxdepth = 0;
                   $opens_new = array();
                   recurse($tree, $maxdepth, $opens, $opens_new, $top, 0);
                   $opens = $opens_new;
                   return array($tree, $maxdepth);
              }
              if (!is_array($session->opens) || !$click) $session->opens = array();
              for($i = 0; $i < $trees; $i++)
                   if (!is_array($session->opens[$i]))
                        $session->opens[$i] = array();
              if ($click) {
                   $side += 0;
                   $id += 0;
                   if ($side < 1 || $side > $trees) $side = 1;
                   $session->opens[$side-1][$id] = ($click == 2);
              }
         ?>
         <form name="enableform" action="diradmin.php" method="post">
              <table border="0" cellpadding="0" cellspacing="0" width="95%">
                   <tr>
                        <td valign="top">
                             <? $side = 1; list($tree, $maxdepth) = make_tree($session->opens[$side-1]); ?>
                             <table border="0" cellpadding="0" cellspacing="0">
                                  <th style="line-height: 150%" colspan="<?=($maxdepth+1) ?>">Directory under which to create new one<br /></th>
                                  <tr>
                                            <td class="black2"><input type="radio" name="ddir" value="0" id="ddir0" /></td>
                                            <td width="99%" class="black2"<?=($r->depth < $maxdepth ? (' colspan="'.($maxdepth-$r->depth+1).'"') : '') ?>>
                                                 &nbsp;<label for="<?="ddir0" ?>">&lt;top level&gt;</label>
                                            </td>
                                  </tr>
                                  <? foreach($tree as $r) { ?>
                                       <tr>
                                            <?=str_repeat('<td></td>', $r->depth-1) ?>
                                            <td class="black2"><input type="radio" name="ddir" onClick="document.enableform.name.value='<?=htmlentities($r->name) ?>' ;" value="<?=$r->sys_pk ?>" id="<?="dir{$r->sys_pk}" ?>" /></td>
                                                                        <td width="99%" class="black2"<?=($r->depth < $maxdepth ? (' colspan="'.($maxdepth-$r->depth+1).'"') : '') ?>>
                                             &nbsp;<label for="<?="dir{$r->sys_pk}" ?>"><? if ($r->mode) { ?><a href="<?=htmlentities("dirmodify.phtml?click=".($r->mode == 2 ? 1 : 2)."&id={$r->sys_pk}&side={$side}") ?>" style="color: inherit;"><?=htmlentities(($r->mode == 2) ? '-' : '+') ?><? } ?><?=htmlentities($r->name) ?><? if ($r->mode) { ?></a><? } ?></label>
                                            </td>
                                       </tr>
                                  <? } ?>
                             </table><br />
                             <hr noshade="noshade" width="80%" size="1" />

                             <table border="0" cellspacing="2" cellpadding="0">
                                                        <tr>
                                       <th style="line-height: 150%" colspan="4" align="center">Modify directory</th>
                                  </tr>
                                                        <tr>
                                       <td class="black2" colspan="2" align="center"><em>(Select the value from left Directory )</em></td>
                                  </tr>
                                                        <tr>
                                       <td class="black2">Directory:&nbsp;</td>
                                       <td class="black2"><input type="text" name="name" size="10" /></td>
                                  </tr>

                                                        <tr>
                                     <td class="black2" nowrap>HTML-Informationen:&nbsp;</td>
                                      <td class="black2"><input name="check" type="checkbox" /></td>
                                  </tr>

                                                        <tr>
                                                          <td class="black2">Benutzer und Rechte:</td>
                                                             <input name="rights" type="hidden" value="" />
                                                          <td class="black2"></td>
                                                    </tr>

                                                        <tr>
                                                            <td class="black2">Benutzer: </td>
                                                             <td>
                                                                            <select name="benutzer">
                                                                            <option selected="selected">** Bitte w&auml;hlen **</option>
                                                                                <? foreach($users as $r) { ?>
                                                                            <option value="<?=$r->sys_pk ?>"><?=htmlentities($r->name) ?></option>
                                                                             <? } ?>
                                                                            </select>
                                                              </td>
                                                        </tr>

                                                        <tr>
                                                                <td class="black2">Rechte: </td>
                                  </tr>
                                                            <tr>
                                      <td class="black2"><input id="add" type="radio" name="add" value="1" checked="checked" /> <label for="add">read only</label></td>
                                                         </tr>
                                     <tr>
                                       <td class="black2"><input id="remove" type="radio" name="add" value="2" /> <label for="remove">write only</label></td>
                                                        </tr>
                                     <tr>
                                       <td class="black2"><input id="add" type="radio" name="add" value="3" checked="checked" /> <label for="add">read and write</label></td>
                                                        </tr>
                                     <tr>
                                       <td class="black2"><input id="remove" type="radio" name="add" value="0" /> <label for="remove">no rights</label></td>
                                     </tr>
                                                        <tr>
                                       <td class="black2" colspan="4" align="center"><input type="submit" name="modify" value="Modify" onclick="return confirm('Soll der Eintrag wirklich geaendert werden?');"/></td>
                                                                <td class="black2"><input type="button"  value="Back" name="Back" border="1" onclick="history.back();"></td>
                                                        </tr>
                             </table><br />
                   </td>
                        <td valign="top">&nbsp;&nbsp;&nbsp;</td>
                        <td valign="top">
                             <? $side = 1; list($tree, $maxdepth) = make_tree($session->opens[$side-1]); ?>
                             <table border="0" cellpadding="0" cellspacing="0">
                                  <th style="line-height: 150%" colspan="<?=($maxdepth+1) ?>">Directory to copy rights from<br /></th>
                                  <? foreach($tree as $r) { ?>
                                       <tr>
                                            <?=str_repeat('<td></td>', $r->depth-1) ?>
                                            <td class="black2"><input type="radio" name="dir" value="<?=$r->sys_pk ?>" id="<?="dir{$r->sys_pk}" ?>" /></td>
                                            <td width="99%" class="black2"<?=($r->depth < $maxdepth ? (' colspan="'.($maxdepth-$r->depth+1).'"') : '') ?>>
                                                 &nbsp;<label for="<?="dir{$r->sys_pk}" ?>"><? if ($r->mode) { ?><a href="<?=htmlentities("dirmodify.phtml?click=".($r->mode == 2 ? 1 : 2)."&id={$r->sys_pk}&side={$side}") ?>" style="color: inherit;"><?=htmlentities(($r->mode == 2) ? '-' : '+') ?><? } ?><?=htmlentities($r->name) ?><? if ($r->mode) { ?></a><? } ?></label>
                                            </td>
                                       </tr>
                                  <? } ?>
                             </table><br />
                        </td>
                   </tr>
              </table><br />
         </form>
                 <script language="JavaScript" type="text/javascript">
                 function FunctionName() {
                   var d = document.forms['enableform']; // another cheap attempt to code less
                d.elements['name'].value='<?=htmlentities($r->name) ?>';
                document.enableform.check.checked=true;
                d.elements['rghts'].value='<?=htmlentities($r->field3) ?>';
             }
                </script>
    </body>
</html>
[/color] 


 
 

Recent GIDBlogLast Week of IA Training by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with php5 cgi installation fab13 Apache Web Server Forum 3 19-Nov-2003 09:11
unwanted scrollbar problem kelly001 Web Design Forum 3 24-Oct-2003 10:44
PHP/CSS/Netscape/IE problem... :-D mateo1221 Web Design Forum 1 24-Sep-2003 16:55
link problem [1][2]----- zuzupus MySQL / PHP Forum 0 16-Sep-2003 05:16
select problem zuzupus MySQL / PHP Forum 0 15-Aug-2003 07:25

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 02:02.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.