Jump to content

cyrixware

Members
  • Posts

    171
  • Joined

  • Last visited

    Never

About cyrixware

  • Birthday 05/23/1985

Contact Methods

  • Website URL
    http://motion23.co.nr/
  • Yahoo
    fv_comscie

Profile Information

  • Gender
    Male
  • Location
    Philippines

cyrixware's Achievements

Member

Member (2/5)

0

Reputation

  1. Yes. Create a query to output whats inside the dbase.
  2. Wer did you get the now()? what if create a variable for the date() and pass the date() to the variable.... instead of now in your query change it to the variable you declared for the date.
  3. You can try create a page for your session() and include that file your session() in your every pages...
  4. checkboxes with the same name. i use array. will you please give me a sample codes. if it is ok with you. thanks
  5. hello everyone! i have a very simple problem using checkboxes. i want o disable the remaining checkboxes when i selected the allowable or maximum checkboxes: example: -------------------- NOTE: you can select only a maximum of two fruits. checkbox1 = orange checkbox2 = grapes checkbox3 = guava checkbox4 = apple checkbox5 = orange ------------------- let say for instance i selected the first 2 checkboxes. after that the remaining 3 checkboxes will be disabled. how to do that.
  6. my page works fine the only problem is that let say for example i have 5 items in the row. every items has its own questions and choices a b c and d. So, if i missed one of the item wen i click submit it will not save to the database instead it will go back or point to the user that he/she should select an answer on that item he/she missed. And the previous answer selected by the user is still there if he/she did not finished select all of the items. i have this code: <? include_once("authenticate.php"); $SuID = $_REQUEST['SuID']; $SuCourse = $_REQUEST['SuCourse']; $SCode = $_REQUEST['SCode']; include("../connDB.php"); $sql_search = "SELECT * FROM studans WHERE SubCode = '$SCode' AND SuID = '$SuID'"; $q_search = mysql_query($sql_search); $num_rows = mysql_num_rows($q_search); if( $num_rows != 0 ) { ?> <script language="JavaScript"> win = window.open('topicareaStudent.php?ID=<?=$session_id;?>&SuID=<?=$SuID;?>&SuCourse=<?=$SuCourse;?>','_self'); alert("Topic Area = <?=$SCode;?> submitted already!"); </script> <? } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Welcome <?=$r['SuFirstname'];?>! </title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="CSSfile.css" rel="stylesheet" type="text/css"> <STYLE type=text/css media=screen> @import url(student/tanfa.css); #menu { FLOAT: left; WIDTH: 100% } #menu UL { PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FLOAT: left; PADDING-BOTTOM: 0px; MARGIN: 0px; WIDTH: 12em; PADDING-TOP: 0px; LIST-STYLE-TYPE: none } #menu A { BORDER-RIGHT: #888 1px solid; PADDING-RIGHT: 3px; BORDER-TOP: #ccc 1px solid; DISPLAY: block; PADDING-LEFT: 3px; PADDING-BOTTOM: 2px; MARGIN: 0px; FONT: bold 11px/16px arial, helvetica, sans-serif; BORDER-LEFT: #bbb 1px solid; PADDING-TOP: 2px; BORDER-BOTTOM: #555 1px solid } #menu H2 { BORDER-RIGHT: #888; PADDING-RIGHT: 3px; BORDER-TOP: #ccc; DISPLAY: block; PADDING-LEFT: 3px; PADDING-BOTTOM: 2px; MARGIN: 0px; FONT: bold 11px/16px arial, helvetica, sans-serif; BORDER-LEFT: #bbb; PADDING-TOP: 2px; BORDER-BOTTOM: #555} #menu H2 { TEXT-TRANSFORM: uppercase; COLOR: #333333; border: 1px solid #999999; } #menu A { BACKGROUND: #efefef; COLOR: #000; TEXT-DECORATION: none } #menu A:hover { BACKGROUND: #fff; COLOR: #0066FF} #menu LI { POSITION: static; left: 290px; top: 89px; } #menu UL UL { Z-INDEX: 500; POSITION: absolute } #menu UL UL UL { LEFT: 100%; POSITION: absolute; TOP: 0px } DIV#menu UL UL { DISPLAY: none } DIV#menu UL LI:hover UL UL { DISPLAY: none } DIV#menu UL UL LI:hover UL UL { DISPLAY: none } DIV#menu UL LI:hover UL { DISPLAY: block } DIV#menu UL UL LI:hover UL { DISPLAY: block } DIV#menu UL UL UL LI:hover UL { DISPLAY: block } table { border:1px solid #000; border-collapse:collapse; font-family:verdana; font-size:50%; } td,th{ border:0px solid #000; border-collapse:collapse; padding:1px; background-color:#cccccc; } a:link {text-decoration:none; color:#000066;} a:visited {text-decoration:none; color:#000066;} a:active {text-decoration:none; color:#000066;} a:hover {text-decoration:none; color:#FF0000;} .style3 {font-size: 10px} .style4 {font-size: 12px} .style13 {font-family: Arial, Helvetica, sans-serif} .style19 {color: #000066} <!-- .timeClass { font-family:arial,verdana,helvetica,sans-serif; font-weight:normal; font-size:10pt; } .style22 {font-family: arial,verdana,helvetica,sans-serif; font-weight: normal; font-size: 10pt; color: #FF0000; } .style23 {color: #FF0000} --> </STYLE> <!--[if IE]> <STYLE type=text/css media=screen>BODY { FONT-SIZE: 100%; BEHAVIOR: url(csshover.htc) } #menu UL LI { FLOAT: left; WIDTH: 100% } #menu UL LI A { HEIGHT: 1% } #menu A { FONT: bold 0.7em/1.4em arial, helvetica, sans-serif } #menu H2 { FONT: bold 0.7em/1.4em arial, helvetica, sans-serif } </STYLE> <![endif]--> <META content="MSHTML 6.00.2900.2604" name=GENERATOR></HEAD> <body> <script language="JavaScript"> function form_validator(theForm) { if(theForm.studAns[].value == "") { alert("Please enter your choice."); theForm.studAns[].focus(); return(false); } } </script> <form onSubmit="return form_validator(this)" name="form" id="form" method="post" action="topicareaQuiz.php?ID=<?=$session_id;?>&SuID=<?=$SuID;?>&SuCourse=<?=$SuCourse;?>&SCode=<?=$SCode;?>"> <center> <div id="container"> <div id="header"> <div id="backimage"> <div id="navbar"> <DIV id="menu"> </DIV> </div> </div> </div> <div id="main"> <div id="content1"> <? $SCode = $_REQUEST['SCode']; $SuID = $_REQUEST['SuID']; $SuCourse = $_REQUEST['SuCourse']; include("../connDB.php"); $sql_display_students_enrolled = "SELECT * FROM testques WHERE SubCode = '$SCode' ORDER BY RAND()"; $sql_display_students_enrolled1 = "SELECT * FROM subject WHERE SCode = '$SCode'"; $q_display_students_enrolled1 = mysql_query($sql_display_students_enrolled1); if(!$q_display_students_enrolled = mysql_query($sql_display_students_enrolled)) { ?> <script language="JavaScript"> win = window.open('topicareaStudent.php?ID=<?=$session_id;?>&SuID=<?=$SuID;?>&SuCourse=<?=$SuCourse;?>','_self'); alert("Query search result... Unable to display the test questions!"); </script> <? } elseif(mysql_num_rows($q_display_students_enrolled) == 0) { ?> <script language="JavaScript"> win = window.open('topicareaStudent.php?ID=<?=$session_id;?>&SuID=<?=$SuID;?>&SuCourse=<?=$SuCourse;?>','_self'); alert("Query search result... Unable to display the test questions!"); </script> <? } else { ?> <center> <? $r_display_students_enrolled1 = mysql_fetch_assoc($q_display_students_enrolled1); ?> <a name="top"></a> <table width="61%" border="0" cellpadding="0" cellspacing="0"> <tr> <td colspan="4"><div align="center"><font color="#000066" size="4" face="Verdana, Arial, Helvetica, sans-serif"></font></div></td> </tr> <tr> <td colspan="4"><font color="#000066" size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font><font color="#000066" size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font><font color="#000066" size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font><font color="#000066" size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font> <div align="center"><strong></strong></div></td> </tr> <tr> <td colspan="4"><div align="center"><strong></strong></div> <div align="center"><font color="#000066" size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong> </strong><strong>[</strong></font><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong> </strong><span class="style23"> <?=$r_display_students_enrolled1['SCode'];?> - <?=$r_display_students_enrolled1['SName'];?> </span><strong></strong></font><font color="#000066" size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>]</strong> <strong> </strong></font></div> <hr align="center" width="500"> <p> </p> <div align="center"><strong></strong></div></td> </tr> <? $x = 0; $j = -1; $tItems = 0; while($r_display_students_enrolled = mysql_fetch_array($q_display_students_enrolled)){ $x++; $tItems = $i++; $j++; ?> <tr> <td width="16%"><div align="center" class="style13"> <span class="style4"><font color="#000066"> <span class="style3"> </span> <strong> <? $Item=$r_display_students_enrolled['Item']; echo"$x"; ?> ).</strong></font> </span></div></td> <td colspan="2"><div align="left" class="style13"><strong><font color="#000066" size="2"> <?=$r_display_students_enrolled['SubQues'];?> <strong><font color="#000066" size="2"> </font></strong> </font> </strong></div></td> <td width="3%"> </td> </tr> <tr> <td width="16%"><div align="center" class="style13"> <span class="style4"><font color="#000066"> <span class="style3"> </span> <strong></strong></font></span></div></td> <td colspan="2"><div align="left" class="style13"><strong><font color="#000066" size="2"> <strong><font color="#000066" size="2"> </font></strong> </font> </strong></div></td> <td width="3%"> </td> </tr> <tr> <td rowspan="5"> <div align="center" class="style13"></div> <div align="center" class="style13"> </div></td> <td width="4%"><div align="left" class="style13"><font color="#000066" size="2"><font color="#000066"><? echo"<input name=studAns[$j] type=radio value=A>";?></font> </font></div></td> <td width="77%"><div align="left" class="style13"><font color="#000066" size="2"> A. <?=$r_display_students_enrolled['chA'];?> </font></div></td> <td> </td> </tr> <tr> <td><div align="left" class="style13"><font color="#000066" size="2"><font color="#000066"><? echo"<input name=studAns[$j] type=radio value=B>";?></font> </font></div></td> <td><div align="left" class="style13"><font color="#000066" size="2"> B. <?=$r_display_students_enrolled['chB'];?> </font></div></td> <td> </td> </tr> <tr> <td><div align="left" class="style13"><font color="#000066" size="2"><font color="#000066"><? echo"<input name=studAns[$j] type=radio value=C>";?></font> </font></div></td> <td><div align="left" class="style13"><font color="#000066" size="2"> C. <?=$r_display_students_enrolled['chC'];?> </font></div></td> <td> </td> </tr> <tr> <td><div align="left" class="style13"><font color="#000066" size="2"><font color="#000066"><? echo"<input name=studAns[$j] type=radio value=D>";?></font> </font></div></td> <td><div align="left" class="style13"><font color="#000066" size="2"> D. <?=$r_display_students_enrolled['chD'];?> </font></div></td> <td> </td> </tr> <tr> <td height="17"><span class="style13"></span></td> <td height="17"><div align="left" class="style13"><span class="style3"> <? // echo"$x";?> <span class="style19"> <? //for($y=0; $y<10; $y++){ ?> <input type="hidden" name="Item[]" value="<?=$r_display_students_enrolled['Item'];?>"> <? //=$r_display_students_enrolled['Item'];?> </span> <? //}?> <span class="style19"> <input type="hidden" name="Key[]" value="<?=$r_display_students_enrolled['SubAns'];?>"> </span></span></div></td> <td height="17"> </td> </tr> <tr> <td height="17" colspan="4"><hr align="center" width="500"> <div align="center"></div></td> </tr> <? } } ?> <tr> <td height="23" colspan="4"><div align="center"> <div align="center"><font color="#000066" face="Verdana, Arial, Helvetica, sans-serif"><font color="#000066" face="Verdana, Arial, Helvetica, sans-serif"><font color="#000066" face="Verdana, Arial, Helvetica, sans-serif"><strong><font color="#000066" face="Verdana, Arial, Helvetica, sans-serif"><strong><font color="#000066" face="Verdana, Arial, Helvetica, sans-serif"><strong><font color="#000066" face="Verdana, Arial, Helvetica, sans-serif"><font color="#000066" face="Verdana, Arial, Helvetica, sans-serif"><font color="#000066" face="Verdana, Arial, Helvetica, sans-serif"><font color="#000066" face="Verdana, Arial, Helvetica, sans-serif"><font color="#000066" face="Verdana, Arial, Helvetica, sans-serif"><font color="#000066" face="Verdana, Arial, Helvetica, sans-serif"><strong><font color="#000066" face="Verdana, Arial, Helvetica, sans-serif"><strong><font color="#000066" face="Verdana, Arial, Helvetica, sans-serif"><strong> <input type="submit" name="Submit" value="Submit"> </strong></font></strong></font></strong></font></font></font></font></font></font></strong></font></strong></font></strong></font></font></font></div> </div></td> </tr> </table> </div> </div> <div id="footer" align="center"></div> </div> </center> </form> </body> </html> <? if($_REQUEST['Submit'] == "Submit"){ include("../connDB.php"); $SCode = $_REQUEST['SCode']; $SuID = $_REQUEST['SuID']; $SItems = $_REQUEST['Item']; $SAns = $_REQUEST['studAns']; $SKey = $_REQUEST['Key']; $count = count($_REQUEST['studAns']); $varX = count($_REQUEST['Key']); for ($varY = $count ; $varY < $varX ; $varY++) { if ((!$_POST[studAns][$varY]) || ($_POST[studAns][$varY] = " ")) { ?> <script language="JavaScript"> //win = window.open('topicareaQuiz.php?ID=<?=$session_id;?>&SuID=<? echo"$SuID";?>&SuCourse=<? echo"$SuCourse"; ?>&SCode=<? echo "$SCode";?>','_self'); alert("Please select answer in every item!"); </script> <? exit; } } $sql = "SELECT * FROM studans WHERE SubCode = '$SCode' AND SuID = '$SuID' "; $q_add = mysql_query($sql); $num = mysql_num_rows($q_add); if( $num != 0 ) { ?> <script language="JavaScript"> win = window.open('topicareaStudent.php?ID=<?=$session_id;?>&SuID=<?=$SuID;?>&SuCourse=<?=$SuCourse;?>','_self'); alert("Topic Area = <?=$SCode;?> submitted already!"); </script> <? }else{ $i = strtoupper(count($_REQUEST['studAns'])); for ($x = 0 ; $x < $i ; $x++) { $item++; $sql_add = "INSERT INTO studans ( SuID, SubCode, SubItems, SubKey, SubAns ) VALUES ( '$SuID'," . "'" . "$SCode" ."',". "'" . $_REQUEST['Item'][$x] . "',". "'" . $_REQUEST['Key'][$x] . "',". "'" . $_REQUEST['studAns'][$x] . "')"; $q_add = mysql_query($sql_add); if(mysql_affected_rows() == 0) { echo "<font color=#FF0000 size=2 face=Verdana, Arial, Helvetica, sans-serif><strong>Cannot Save Record at this time try again later...</strong></font>"; }else { ?> <script language="JavaScript"> win = window.open('topicareaQuiz.do.php?SCode=<? echo "$SCode";?>&SuID=<? echo"$SuID";?>&SuCourse=<?=$SuCourse;?>&tItems=<?=$tItems+1;?>','_self'); //alert("Processing... Please click OK to submit the exam."); </script> <? } } } } ?>
  7. <?php $sql_update = "UPDATE studsubj SET SCourse = '$SuCourse', SCode ='$SCode', SuID = '$SuID', SuGrade = '$ave' WHERE SCode = '$SCode' AND SuID = '$SuID'"; $q_update= mysql_query($sql_update); mysql_error(); ?> Got it i change my query like this one... hehehe
  8. The problem is that when i hit the submit button after this codes the page goes blank.
  9. The problem is that when i click the submit button the page turns blank... maybe thers something wrong in this line $sql_update = "UPDATE studsubj SET SCourse = '$SuCourse', SCode ='$SCode', SuID = '$SuID', SuGrade = '$ave' WHERE SCode = '$SCode' AND SuID = '$SuID'"; Because when i erased this one: WHERE SuID = '$SuID'"; from WHERE SCode = '$SCode' AND SuID = '$SuID'"; it works fine. but the problem is i need to bind or use the SuID and SuCourse togethere... <?php $sql_update = "UPDATE studsubj SET SCourse = '$SuCourse', SCode ='$SCode', SuID = '$SuID', SuGrade = '$ave' WHERE SCode = '$SCode' AND SuID = '$SuID'"; if(!$q_update = mysql_query($sql_update)) { die(mysql_error()); } elseif(mysql_affected_rows() == 0) { die(mysql_error()); } else { ?> <script language="JavaScript"> alert("Correct Answers = <?=$CorrectAns;?> out of <?=$tItems;?> Average = <?=$ave;?>%."); win = window.open('topicareaStudent.php?ID=<?=$session_id;?>&SuID=<?=$SuID;?>&SuCourse=<?=$SuCourse;?>','_self'); </script> <?php } ?>
  10. this one: <a href="example.php?ID=<? Echo $row->SuID;?>&Course=<? Echo $row->SuCourse; ?>" target="_blank" class="style5">Generate </a> or <a href="example.php?ID=<?=ID;?>&Course=<?=Course; ?>" target="_blank" class="style5">Generate </a>
  11. simple passing variable in the url: <a href="exmple.php?ID=<?php row->ID;?>&NAME=<?php row->name;?>">click here</a>
  12. firstname:<INPUT TYPE="TEXT" NAME="firstname" VALUE="<?php echo $myrow["firstname"]; ?>" SIZE=30><br> lastname:<input type="text" NAME="lastname" value="<? echo $myrow["lastname"]; ?>"size =30 ><br> TotalScore:<INPUT TYPE="TEXT" NAME="totalscore" VALUE="<?php echo $myrow["TotalScore"]; ?>" SIZE=30><br> Check your code. add semi color after the lines.....
  13. Hi rhodesa what is the best way in a username and password?
  14. How to achive this one to make the username and password a case sensitive? <?php if($_REQUEST['Submit'] == "Login") { $username = $_REQUEST['username']; $passwrd = md5($_REQUEST['passwrd']); include("../connDB.php"); $sql = "SELECT teacher.*, security.* FROM teacher, security WHERE teacher.TUsername = '$username' AND teacher.TPassword = '$passwrd' AND security.SecStaff = 'Enabled'"; if(!$q = mysql_query($sql)) { die(mysql_error()); } elseif(mysql_num_rows($q) == 0) { ?> <script language=JavaScript> alert("Invalid username, password or account disabled. Please contact the Administrator. Try Again!"); </script> <?php } else { $r = mysql_fetch_assoc($q); $TID = $r['TID']; $session_id = md5(date("Y-m-d H:i:s") . $TID); $sql1 = "UPDATE teacher SET TSessionID= '$session_id' WHERE TID = '$TID'"; if(!$q1 = mysql_query($sql1)) { die(mysql_error()); } elseif(mysql_affected_rows() == 0) { echo "<font size=2 face=Verdana color=red>Failed to create session id!</font>"; } else { $_SESSION['session_id'] = $session_id; } } $session_id = $_SESSION['session_id']; if($session_id != null && $session_id != "") { ?> <script language=JavaScript> win = window.open('faculty.php?ID=<?=$session_id;?>','_self') </script> <?php } } ?>
  15. How to make a case sensitive in my query? should i used query or there is something in mysql database? (Ex. using username and password textfield) Reply is highly appreciated. Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.