Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: Php

  1. #1
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Php

    hi this is my code
    Code:
    <body onLoad="hidetext();">
    <table width="1000" height="212" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td valign="top"><?php 
    
    include("header.inc.php");
    
    ?>
    </td>
    </tr>
    <tr>
      <td><table width="996" height="20" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td colspan="2" align="right"><?php
    if($_SESSION['admin']!="")
    {
    	echo "<a href='logout.php'><font color=blue><b>Logout</b></font></a>";
    }
    ?></td>
        </tr>
        
        <tr>
          <td width="198" valign="top"><?php 
    
    include("side_menu.inc.php");
    
    ?></td>
          <td width="798" valign="top"><form name="test" id="test" method="post" action="testsave.php"  >
            <table width="682" height="130" border="0">
              <tr>
                <td width="106">&nbsp;</td>
                <td width="257">&nbsp;</td>
                <td width="27">&nbsp;</td>
                <td width="274">&nbsp;</td>
              </tr>
              <tr>
                <td height="24"><strong>TEST NAME</strong></td>
                <td><strong>&nbsp;&nbsp;:</strong>
                  <input type="text" name="test" id="test" class="validate[required]" /></td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
              <tr>
          <td width="106"><strong>SUBJECT</strong></td>
    	  
             <td><strong>&nbsp;&nbsp;:</strong>          
    		  <select id="subject" class="validate[required]" name="subject" onChange="if(this.value=='other'){ show ('sub');} else {hide ('sub');}">
    		   <option value="">Select</option>
    		        <?php 
    		            $qry=mysql_query("select distinct (subject) from test_entry where subject!=''");
    		            while($row=mysql_fetch_array($qry))
    		        {?>
    		   <option value="<?php echo $row['subject']?>"><?php echo $row['subject']?></option>
    		        <?php
    		        }?>
    		   <option value="other">Other Please Specify</option>
    		   </select></td>
    		          <td colspan="4" style="display:none" id="sub">&nbsp;
    	                <input type="text" id="other_subject" name="other_subject" style="width:250px"/></td></tr>
    		  <table width="300" height="100">
    		  <tr>
    		  <td><input type="hidden" name="unit" id="unit"/></td></tr>
    		  <tr>
    	         <td><strong>unit 1</strong></td>
    		     <td><input type="radio" name="units" id="radio1" value="unit 1" onClick="add(this.value,'unit')","showtext('unit 1');"/></td> 
    			 	  </tr>
    	  <tr>
    	         <td><strong>unit 2</strong></td>
    		     <td><input type="radio" name="units" id="radio1" value="unit 2" onClick="add(this.value,'unit')","showtext('unit 1');"/></td> 
    	  
    	 </tr>
    	 <tr>
    		    <td><strong>unit 3</strong></td>
    		    <td><input type="radio" name="units" id="radio3" value="unit 3 " onClick="add(this.value,'unit')","showtext('unit 1');"/></td>
    	</tr>
    	<tr>
    		    <td><strong>unit 4</strong></td>
    		    <td><input type="radio"  name="units"  id="radio4" value="unit 4 " onClick="add(this.value,'unit')","showtext('unit 1');"/></td>
    	</tr>
    	<tr>
    		    <td><strong>unit 5</strong></td>
    		    <td><input type="radio"  name="units" id="radio5" value="unit 5 " onClick="add(this.value,'unit')","showtext('unit 1');"/></td>
    	</tr>
    	<tr>
    		    <td><strong>unit 6</strong></td>
    		    <td><input type="radio"  name="units" id="radio6" value="unit 6 " onClick="add(this.value,'unit')","showtext('unit 1');"/></td>
    	</tr>
    	<tr>
    		    <td><strong>unit 7</strong></td>
    		    <td><input type="radio"  name="units" id="radio7" value="unit 7 " onClick="add(this.value,'unit')","showtext('unit 1');"/></td>
    	</tr>
    	<tr>
    		    <td><strong>unit 8</strong></td>
    		    <td><input type="radio"  name="units" id="radio8" value="unit 8 " onClick="add(this.value,'unit')","showtext('unit 1');"/></td>
    	</tr>
    	<tr>
    		    <td><strong>unit 9</strong></td>
    		    <td><input type="radio"  name="units" id="radio9" value="unit 9 " onClick="add(this.value,'unit')","showtext('unit 1');"/></td>
    	</tr>
    	<tr>
    		    <td><strong>unit 10</strong></td>
    		    <td><input type="radio"  name="units" id="radio10" value="unit 10" onClick="add(this.value,'unit')","showtext('unit 1');"/></td>
    	</tr>
    	
    	          <div id="div1" style="display:none"><tr>
    			  <td><strong>NO. Of QUESTION</strong></td>
    			  <td>&nbsp;<strong>:</strong>&nbsp;<input name="qus" type="text" id="qus" onChange="return chkmarks('qus')" /></td>
    			  <td><strong>MARKS For Each Question</strong></td>
    			  <td><strong>:</strong>&nbsp;&nbsp;<input name="marks" type="text" id="marks" onChange="return chkmarks('marks')" /></td></tr>
    			  <tr><td>&nbsp;</td>
    			  <td>&nbsp;</td>
        <tr>
    	          <td>&nbsp;</td>
    			  <td>&nbsp;</td>
    			  <td>&nbsp;</td>
    			  <td><input type="button" name="addmore" id="addmore" value="Add More" onClick="addtext('unit','qus','marks','addoptn[]','addunit[]','addqus[]','addmarks[]');"/></td>
    			  <td><select name="addoptn[]" size="3" style="width:150px" multiple="multiple" id="addoptn[]"></select>
    			<input type="button" name="remoptn" id="remoptn" value="Remove" onClick="remtext('addoptn[]');" /></td>
    	</tr>
    			<td><select name="addunit[]" id="addunit[]" size="5" multiple="multiple" style="display:none"></select></td>
    			<td><select name="addqus[]" id="addqus[]" size="5" multiple="multiple" style="display:none"></select></td>
    			<td><select name="addmarks[]" id="addmarks[]" size="5" multiple="multiple" style="display:none" ></select></td></tr></div>
    			<td width="126"><input type="submit" name="submit" id="submit" value="save" /></td>
         </tr></table>
    		  </table>
          </form></td>
        </tr>
        <tr>
          <td colspan="2">&nbsp;</td>
        </tr>
      </table></td>
    </tr>
    <tr>
      <td valign="top"></td>
    </tr>
    </table>
     </body>
    </html>
    In this page when we select unit then qus and marks text boxes should open automatically and once a unit selected it should be hide for that subject
    Last edited by oracleguy; 08-20-2011 at 03:38 PM. Reason: please use code tags when posting

  • #2
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    So it's a javascript thing you're after then?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •