473,408 Members | 2,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

automatic appear

47
Expand|Select|Wrap|Line Numbers
  1. <input name="matric" type="text" class="style26" id="matric" value="<?php echo $row_rs_mas['matric_no']; ?>" size="15" /> 
<------ this input that i insert those matric_no

Expand|Select|Wrap|Line Numbers
  1. <input name="name" type="text" class="style26" id="name" value="<?php echo $row_rs_mas['name']; ?>" size="50"/>
<------ appear automatic when I insert the matric_no..

my problem is how to make it automatically appear when insert matric_no
Jul 23 '08 #1
25 1876
maminx
77
where do you want to appear that value???is it in input or what type of tag??

if you want to appear the value of matric_no (input), than you can use the div or something tag to store that value...
Jul 23 '08 #2
azura
47
yup.. i want to appear dynamically value in that input"name"..like this.. if i key in matric no, then dynamically appear those name... those name n matric are in database
Jul 23 '08 #3
maminx
77
yup.. i want to appear dynamically value in that input"name"..like this.. if i key in matric no, then dynamically appear those name... those name n matric are in database

i see, so you want to appear the name that you input from textfield and get + check the name whether it is in the database or not,, i think you must use AJAX, and you just need to learn that things in this URL

AJAX

kind regards,
mamin
Jul 23 '08 #4
azura
47
Expand|Select|Wrap|Line Numbers
  1.  var url="gethint.asp";
  2. url=url+"?q="+str;
  3. url=url+"&sid="+Math.random();
  4. xmlHttp.onreadystatechange=stateChanged;
  5. xmlHttp.open("GET",url,true);
  6. xmlHttp.send(null);
what this function are for??? because i had try so many time but still error..i'm new ni ajax..please help me...
Jul 23 '08 #5
gits
5,390 Expert Mod 4TB
basicly it starts a XMLHttpRequest in the background to invoke the code that is found at the 'url'. you assign a callback-function to the onreadystatechange-property of the request-object and this function is called every time the state of the request-object changes. the code you posted is not enough ... you need the full code from an example ... post how you tried to make the call with all relevant lines ...

kind regards
Jul 23 '08 #6
azura
47
before this i tried to make with some button but my boss doesn't want those button... so he want to make those data dynamically appear... i'm very newbie in java n ajax.. i'm so stuck right now!
Jul 23 '08 #7
gits
5,390 Expert Mod 4TB
post what you have tried so far ... may be just use a textbox and try to demonstrate your attempt and tell us where you're stuck ... so that we may help you with your particular problem ...

kind regards
Jul 23 '08 #8
azura
47
[HTML]


<body <?php if($saved){echo 'onload="alert(\'One record successfully saved.\');"';}?>>
<form id="form1" name="form1" method="POST">
<div align="center">
<p>&nbsp;</p>
<table width="456" height="436" align="center" bordercolor="#CCFFCC" class="boxads">
<tr>
<td height="46" colspan="5" bgcolor="#FFFFCC"><p align="center" class="style16">&nbsp;</p>
<p align="center" class="style16 style18">Medic Assessment System </p>
<p align="center" class="style16">&nbsp;</p></td>
</tr>
<tr>
<td height="29" colspan="5" bgcolor="#FFFFFF" class="style12"><div align="center" class="style10"><span class="style17 style23">Block Registration</span></div>
<span class="style8">
<label></label>
</span><span class="style8">
<label></label>
</span><span class="style1"></span><span class="style1">
<label></label>
</span>
<div align="center" class="style17"></div></td>
</tr>
<tr>

<td width="82" height="35" bgcolor="#CCFFCC"><div align="right" class="style26">Matric No</div></td>
<td width="11" bgcolor="#CCFFCC"><div align="center" class="style26">:</div></td>
<td colspan="3" bgcolor="#CCFFCC"><div align="left">

<input name="matric" type="text" class="style26" id="matric" value="<?php echo $row_rs_mas['matric_no']; ?>" size="15" />
</div></td>
</tr>
<tr>
<td height="32" bgcolor="#CCFFCC"><div align="right" class="style26">Name</div></td>
<td width="11" bgcolor="#CCFFCC"><div align="center" class="style26">:</div></td>
<td colspan="3" bgcolor="#CCFFCC"><div align="left">
<p>
//this part i want to make dynamically appear
<input name="name" type="text" class="style26" id="name" value="<?php echo $row_rs_mas['name']; ?>" size="50"/>
</p>
</div></td>
</tr>
<tr>
<td height="114" bgcolor="#CCFFCC"><div align="right"><span class="style26">Sessi</span></div></td>
<td bgcolor="#CCFFCC"><div align="center" class="style26"><strong>:</strong></div></td>
<td bgcolor="#CCFFCC"><div align="left">
<input name="sessi" type="text" class="style26" id="sessi" size="15" maxlength="9" />
</div></td>
<td bgcolor="#CCFFCC"><div align="right"><span class="style26">Year:</span></div></td>
<td bgcolor="#CCFFCC"><p>&nbsp;
</p>
<p>&nbsp;</p>
<p>
<select name="year" class="style26" id="year" value="<?php echo $row_scode['year']; ?>" >
<option value="-"> - </option>
<option value="1 block 1"> 1 block 1</option>
<option value="1 block 2"> 1 block 2</option>
<option value="1 block 3"> 1 block 3</option>
<option value="1 block 4"> 1 block 4</option>
<option value=" - "> - </option>
<option value="2 block 1"> 2 block 1</option>
<option value="2 block 2"> 2 block 2</option>
<option value="2 block 3"> 2 block 3</option>
<option value="2 block 4"> 2 block 4</option>
<option value="- "> - </option>
<option value="3 block 1"> 3 block 1</option>
<option value="3 block 2"> 3 block 2</option>
<option value="3 block 3"> 3 block 3</option>
<option value="3 block 4"> 3 block 4</option>
<option value=" - "> - </option>
<option value="4 block 1"> 4 block 1</option>
<option value="4 block 2"> 4 block 2</option>
<option value="4 block 3"> 4 block 3</option>
<option value="4 block 4"> 4 block 4</option>
<option value="4 block 5"> 4 block 5</option>
<option value="4 block 6"> 4 block 6</option>
<option value="4 block 7"> 4 block 7</option>
<option value=" - "> - </option>
<option value="5 block 1"> 5 block 1</option>
<option value="5 block 2"> 5 block 2</option>
<option value="5 block 3"> 5 block 3</option>
<option value="5 block 4"> 5 block 4</option>
<option value="5 block 5"> 5 block 5</option>
</select>
</p>
<p>
//this part i want to make dynamically appear
<input name="s_code" type="text" class="style26" id="s_code" value="<?php echo $row_scode['s_code']; ?>"/>
</p>
<p>&nbsp;</p></td>
</tr>

<tr>
<td height="27" bgcolor="#CCFFCC"><div align="right" class="style26">Group</div></td>
<td bgcolor="#CCFFCC"><div align="center" class="style26">:</div></td>
<td width="90" bgcolor="#CCFFCC"><div align="left">
<p class="style25">
<select name="group" size="1" class="style26" id="group">
<option value="-">-</option>
<option value="1" >1</option>
<option value="2" >2</option>
<option value="3" >3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
</select>
</p>
</div></td>
<td width="73" bgcolor="#CCFFCC"><div align="right"></div></td>
<td width="176" bgcolor="#CCFFCC">&nbsp;</td>
</tr>

<tr>
<td height="24" colspan="5" bgcolor="#CCFFCC"><div align="center">
<input name="save" type="submit" class="style26" id="save" value="Save" />
<input name="Reset" type="reset" class="style26" value="Reset" />
</div>
<div align="center"></div></td>
</tr>
</table>

</html> [/HTML]
hurm i send my coding... there is 2 part which i want to make it dynamically appear..
Jul 23 '08 #9
azura
47
anybody can help me??
Jul 25 '08 #10
gits
5,390 Expert Mod 4TB
so what you want is that you put in the matric_no and then the corresponding textboxes name and s_code should be populated automatically.

the general idea is the following:

1. onchange of the textbox matric_no call a js-function that starts a XMLHttpRequest and retrieves the data from the database

2. in the callbackfunction of that request you process the responseText and fill in the data into the corresponding fields ...

are you familiar with such an ajax-call? did you use/try that before?

kind regards
Jul 25 '08 #11
azura
47
yup you right! when i put matric_no textfield name will automatically appear the name so with if i select year,s_code will automatically appear...

i'm not familiar with ajax and that's why i need somebody help me.... urgent and really urgent....plezzzz!!!
Jul 26 '08 #12
gits
5,390 Expert Mod 4TB
ok ... so let me give you a short example, it uses GET and requests just a local file called test.txt where you could put in any text ... when the request is ready it will put this text from the file into the second textbox ... as you see it is quite simple to use the XMLHttpRequest ... note: this example just works with browsers like FF/Safari/Opera (that have a native XMLHttpRequest-Object) since i didn't implement the request-initialisation for IE

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. function _get_request_obj() {
  5.     var obj = null;
  6.  
  7.     if (typeof window.XMLHttpRequest != 'undefined') {
  8.         obj = new XMLHttpRequest;
  9.     } else if (typeof window.ActiveXObject != 'undefined') {
  10.         // MS specific trunk to init a request-object
  11.     }
  12.  
  13.     return obj;
  14. }
  15.  
  16. function get_data(val, id) {
  17.     var obj = _get_request_obj();
  18.  
  19.     if (obj == null) {
  20.         alert('currently no ajax-call supported');
  21.     } else {
  22.         _request_data(obj, val, id);
  23.     }
  24. }
  25.  
  26. function _request_data(req, val, id) {
  27.     var qs = 'test.txt?val=' + val;
  28.  
  29.     req.open('GET', qs, true);
  30.     req.onreadystatechange = function() {
  31.         if (this.readyState == 4) {
  32.             var result_box = document.getElementById(id);
  33.             result_box.value = this.responseText;
  34.         }
  35.     };
  36.     req.send(null);
  37. }
  38.  
  39. </script>
  40. </head>
  41. <body>
  42.     <form>
  43.         <input type="text" id="my_box_1" onchange="get_data(this.value, 'my_result');"/>
  44.         <input type="text" id="my_result"/>
  45.     </form>
  46. </body>
  47. </html>
  48.  
kind regards
Jul 26 '08 #13
azura
47
what if i want to implement with ff and ie?? sorry i still don't get it... if i implement your example in my line, which want should i change..?? test.txt stand for what??
Jul 26 '08 #14
gits
5,390 Expert Mod 4TB
1. test.txt stands for the requested program ... so qs has to be your querystring (probably a php-file and some get-params in case you want to use GET) ...

2. for IE you have to create an instance of an ActiveX object like this (that would replace the comment in line 10):

Expand|Select|Wrap|Line Numbers
  1. try {
  2.     obj = new ActiveXObject('Msxml2.XMLHTTP');
  3. } catch (ex) {
  4.     try {
  5.         obj = new ActiveXObject('Microsoft.XMLHTTP');
  6.     } catch (ex) {
  7.     }
  8. }
note: make an attempt and show what you have done ... at this forum nobody is supposed to do your work for you or give you a complete solution ... with the currently given example you could simulate one test for your requirement ... just try to adapt it to your problem and show the code that is not working and ask specific questions ... a thread like this is not the appropriate place to give you a complete ajax-tutorial ... so you need to search for some basic information for your own ... ok?

kind regards
Jul 26 '08 #15
azura
47
oh ok..sorry because i'm newbie to the forum.. so thanks for your help
Jul 26 '08 #16
gits
5,390 Expert Mod 4TB
there is no problem and there is no need to apologize ... just come back when you have specific questions about the correct implementation of the code i showed you ... and post what you have tried so far to get it to work ... the general idea is to let you learn something ... i'm happy to explain everything to you but i should have at least the 'feeling' that you are interested in it and try to understand the code ... vs just waiting to get a copy and paste script ...

kind regards
Jul 26 '08 #17
azura
47
[PHP]<?php require_once('Connections/mas.php'); ?>
<?php
//initialize the session
if (!isset($_SESSION)) {
session_start();
}

// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
$logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
//to fully log out a visitor we need to clear the session varialbles
$_SESSION['MM_Username'] = NULL;
$_SESSION['MM_UserGroup'] = NULL;
$_SESSION['PrevUrl'] = NULL;
unset($_SESSION['MM_Username']);
unset($_SESSION['MM_UserGroup']);
unset($_SESSION['PrevUrl']);

$logoutGoTo = "login.php";
if ($logoutGoTo) {
header("Location: $logoutGoTo");
exit;
}
}
?>
<?php
if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;

// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && true) {
$isValid = true;
}
}
return $isValid;
}

$MM_restrictGoTo = "login.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["name"])) && ($_POST["name"] != "")) {
$insertSQL = sprintf("INSERT INTO medic_block_reg (matric_no, name, sessi, `year`, `group`) VALUES (%s, %s, %s, %s, %s)",
GetSQLValueString($_POST['matric'], "text"),
GetSQLValueString($_POST['name'], "text"),
GetSQLValueString($_POST['sessi'], "text"),
GetSQLValueString($_POST['year'], "text"),
GetSQLValueString($_POST['group'], "int"));

$insertSQL2 = sprintf("INSERT INTO medic_registered_course (matric_no, name, sessi, `year`,`s_code`, `group`) VALUES (%s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['matric'], "text"),
GetSQLValueString($_POST['name'], "text"),
GetSQLValueString($_POST['sessi'], "text"),
GetSQLValueString($_POST['year'], "text"),
GetSQLValueString($_POST['s_code'], "text"),
GetSQLValueString($_POST['group'], "int"));

mysql_select_db($database_mas, $mas);
$Result1 = mysql_query($insertSQL, $mas) or die(mysql_error());
$Result2 = mysql_query($insertSQL2, $mas) or die(mysql_error());
$saved = true;
}
if ((isset($_POST["name"])) && ($_POST["name"] == "")) {
$colname_rs_mas = "-1";
if (isset($_POST['matric'])) {
$colname_rs_mas = $_POST['matric'];
}
mysql_select_db($database_mas, $mas);
$query_rs_mas = sprintf("SELECT matric_no, name FROM medic_student WHERE matric_no = %s ORDER BY `id` ASC" , GetSQLValueString($colname_rs_mas, "text"));
$rs_mas = mysql_query($query_rs_mas, $mas) or die(mysql_error());
$row_rs_mas = mysql_fetch_assoc($rs_mas);
$totalRows_rs_mas = mysql_num_rows($rs_mas);

if ((isset($_POST["s_code"])) && ($_POST["s_code"] == ""))
$colname_scode = "-1";
if (isset($_POST['year'])) {
$colname_scode = $_POST['year'];
}
mysql_select_db($database_mas, $mas);
$query_scode = sprintf("SELECT `year`, s_code FROM medic_subject_offered WHERE `year` = %s", GetSQLValueString($colname_scode, "text"));
$scode = mysql_query($query_scode, $mas) or die(mysql_error());
$row_scode = mysql_fetch_assoc($scode);
$totalRows_scode = mysql_num_rows($scode);

}


?>

<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Block Registration | Medic Assessment System</title>
<link href="css/lgblue.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style1 {font-family: Arial, Helvetica, sans-serif}
.style10 {font-family: Arial, Helvetica, sans-serif; font-size: 12px; }
.style12 {font-family: Arial, Helvetica, sans-serif; font-size: 14px; }
.style16 {font-size: 18px;
color: #000000;
}
.style8 {font-family: Arial, Helvetica, sans-serif; font-size: 10; }
.style17 {
font-style: italic;
font-size: small;
font-weight: bold;
}
.style18 {
font-size: 14px;
font-weight: bold;
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
a:active {
text-decoration: none;
}
body,td,th {
color: #996600;
}
.style23 {color: #000000}
.style25 {font-family: Arial, Helvetica, sans-serif; font-weight: bold; }
.style26 {
font-size: 12px;
font-weight: bold;
color: #000000;
}
.style28 {color: #000000; font-weight: bold; }
-->
</style>
<script type="text/JavaScript">
<!--
function MM_popupMsg(msg) { //v1.0
alert(msg);
}
function MM_controlSound(x, _sndObj, sndFile) { //v3.0
var i, method = "", sndObj = eval(_sndObj);
if (sndObj != null) {
if (navigator.appName == 'Netscape') method = "Play";
else {
if (window.MM_WMP == null) {
window.MM_WMP = false;
for(i in sndObj) if (i == "ActiveMovie") {
window.MM_WMP = true; break;
} }
if (window.MM_WMP) method = "play";
else if (sndObj.FileName) method = "run";
} }
if (method) eval(_sndObj+"."+method+"()");
else window.location = sndFile;
}
//-->
</script>
<script src="clienthint.js">
var xmlHttp

function showHint(str)
{
if (str.length==0)
{
document.getElementById("txtHint").innerHTML=""
return
}
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
var url="gethint.php"
url=url+"?q="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function stateChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
document.getElementById("txtHint").innerHTML=xmlHt tp.responseText
}
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
</script>
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>

<body <?php if($saved){echo 'onload="alert(\'One record successfully saved.\');"';}?>>

<form id="form1" name="form1" method="POST">
<div align="center">
<p>&nbsp;</p>
<table width="456" height="347" align="center" bordercolor="#CCFFCC" class="boxads">
<tr>
<td height="65" colspan="5" bgcolor="#FFFFCC"><p align="center" class="style16">&nbsp;</p>
<p align="center" class="style16 style18">Medic Assessment System </p>
<p align="center" class="style16">&nbsp;</p></td>
</tr>
<tr>
<td height="29" colspan="5" bgcolor="#FFFFFF" class="style12"><div align="center" class="style10"><span class="style17 style23">Block Registration</span></div>
<span class="style8">
<label></label>
</span><span class="style8">
<label></label>
</span><span class="style1"></span><span class="style1">
<label></label>
</span>
<div align="center" class="style17"></div></td>
</tr>
<tr>
<td width="82" height="35" bgcolor="#CCFFCC"><div align="right" class="style26">Matric No</div></td>
<td width="11" bgcolor="#CCFFCC"><div align="center" class="style26">:</div></td>
<td colspan="3" bgcolor="#CCFFCC"><div align="left">
<input type="text" id="txt1"
onkeyup="showHint(this.value)">
</div></td>
</tr>
<tr>
<td height="33" bgcolor="#CCFFCC"><div align="right" class="style26">Name</div></td>
<td width="11" bgcolor="#CCFFCC"><div align="center" class="style26">:</div></td>
<td colspan="3" bgcolor="#CCFFCC"><div align="left">
<p>
<span id="txtHint"></span>
</p>
</div></td>
</tr>
<tr>
<td height="114" bgcolor="#CCFFCC"><div align="right"><span class="style26">Sessi</span></div></td>
<td bgcolor="#CCFFCC"><div align="center" class="style26"><strong>:</strong></div></td>
<td bgcolor="#CCFFCC"><div align="left">
<input name="sessi" type="text" class="style26" id="sessi" size="15" maxlength="9" />
</div></td>
<td bgcolor="#CCFFCC"><div align="right"><span class="style26">Year:</span></div></td>
<td bgcolor="#CCFFCC"><p>&nbsp;
</p>
<p>&nbsp;</p>
<p>
<select name="year" class="style26" id="year" >
<option value="-"> - </option>
<option value="1 block 1"> 1 block 1</option>
<option value="1 block 2"> 1 block 2</option>
<option value="1 block 3"> 1 block 3</option>
<option value="1 block 4"> 1 block 4</option>
<option value=" - "> - </option>
<option value="2 block 1"> 2 block 1</option>
<option value="2 block 2"> 2 block 2</option>
<option value="2 block 3"> 2 block 3</option>
<option value="2 block 4"> 2 block 4</option>
<option value="- "> - </option>
<option value="3 block 1"> 3 block 1</option>
<option value="3 block 2"> 3 block 2</option>
<option value="3 block 3"> 3 block 3</option>
<option value="3 block 4"> 3 block 4</option>
<option value=" - "> - </option>
<option value="4 block 1"> 4 block 1</option>
<option value="4 block 2"> 4 block 2</option>
<option value="4 block 3"> 4 block 3</option>
<option value="4 block 4"> 4 block 4</option>
<option value="4 block 5"> 4 block 5</option>
<option value="4 block 6"> 4 block 6</option>
<option value="4 block 7"> 4 block 7</option>
<option value=" - "> - </option>
<option value="5 block 1"> 5 block 1</option>
<option value="5 block 2"> 5 block 2</option>
<option value="5 block 3"> 5 block 3</option>
<option value="5 block 4"> 5 block 4</option>
<option value="5 block 5"> 5 block 5</option>
</select>
</p>
<p>
<input name="s_code" type="text" class="style26" id="s_code" value="<?php echo $row_scode['s_code']; ?>"/>
</p>
<p>&nbsp;</p></td>
</tr>

<tr>
<td height="27" bgcolor="#CCFFCC"><div align="right" class="style26">Group</div></td>
<td bgcolor="#CCFFCC"><div align="center" class="style26">:</div></td>
<td width="90" bgcolor="#CCFFCC"><div align="left">
<p class="style25">
<select name="group" size="1" class="style26" id="group">
<option value="-">-</option>
<option value="1" >1</option>
<option value="2" >2</option>
<option value="3" >3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
</select>
</p>
</div></td>
<td width="73" bgcolor="#CCFFCC"><div align="right"></div></td>
<td width="176" bgcolor="#CCFFCC">&nbsp;</td>
</tr>

<tr>
<td height="24" colspan="5" bgcolor="#CCFFCC"><div align="center">
<input name="save" type="submit" class="style26" id="save" value="Save" />
<input name="Reset" type="reset" class="style26" value="Reset" />
</div>
<div align="center"></div></td>
</tr>
</table>
<div align="center">
<p>&nbsp;</p>
<p class="style10"><a href="reg_main.php">Back</a> | <a href="main.php">Module Menu</a> | <a href="reg_query.php"> View Registered Student</a> | <a href="<?php echo $logoutAction ?>" onclick="MM_controlSound('play','document.CS121055 9072500','Windows Notify.wav');MM_popupMsg('You\'re successfully logout from this system...')">Logout</a></p>
</div>
<p align="center">&nbsp;</p>
</div>
<input type="hidden" name="MM_insert" value="form1" />
</form>
<embed name="CS1210559072500" src="Windows Notify.wav" loop="false" autostart="false" hidden="true" width="0" height="0" enablejavascript="true"></embed>
</body>

<?php
if ((isset($_POST["block"])) && ($_POST["block"] == "")) {
mysql_free_result($rs_mas);

mysql_free_result($scode);

}

?>
</html>[/PHP]

i had followed all the basic that i had learn it work if i want to search a name.. what should i do if i want to enter matric(number) and appear those name which are in the databse....
Jul 28 '08 #18
azura
47
i got it! it work! but why can't save into database? it's say name cannot be null... how i'm gonna fix it...?
Jul 29 '08 #19
gits
5,390 Expert Mod 4TB
first: well done :) glad to hear you got it working ... to your question: it seems to be a query-problem ... are all params passed correctly? i think its an insert and is 'name' a db-field? could you show the query and how it is build up in the php?

kind regards
Jul 29 '08 #20
azura
47
[PHP]
if ((isset($_POST["name"])) && ($_POST["name"] != "")) {

$insertSQL = sprintf("INSERT INTO medic_block_reg (matric_no, name, sessi, `year`, `group`) VALUES (%s, %s, %s, %s, %s)",

GetSQLValueString($_POST['matric'], "text"),

GetSQLValueString($_POST['name'], "text"),

GetSQLValueString($_POST['sessi'], "text"),

GetSQLValueString($_POST['year'], "text"),

GetSQLValueString($_POST['group'], "int"));



$insertSQL2 = sprintf("INSERT INTO medic_registered_course (matric_no, name, sessi, `year`,`s_code`, `group`) VALUES (%s, %s, %s, %s, %s, %s)",

GetSQLValueString($_POST['matric'], "text"),

GetSQLValueString($_POST['name'], "text"),

GetSQLValueString($_POST['sessi'], "text"),

GetSQLValueString($_POST['year'], "text"),

GetSQLValueString($_POST['s_code'], "text"),

GetSQLValueString($_POST['group'], "int"));[/PHP]

actually i not done with matric but i tried using drop down menu and use ajax to display infomation.. it woked nicely..!! thanks.. but matric no i now still trying... hehhehe... so sudenlly i got stuck with how to save it.. because it said that s_code can't be null...my registration flow should be like this.. if admin insert data then when they selected one of the drop menu list, it automatic display info about the selected list... but when i click button save, the automatic display(s_code) cannot be insert in database..error:s_code cannot be null?? can you explain what's wrong..???
Jul 29 '08 #21
gits
5,390 Expert Mod 4TB
is s_code posted to the php-script correctly? is the s_code field filled in the form before you submit it?
Jul 29 '08 #22
azura
47
the s_code is automatic display which is connected to the selected year...s_code i'm using ajax.. currently i have 3 pages to do this ajax... then i implement into the original page.. so i had paste my script java to the original page..but the php page i do not implement into the original page..should i paste it same as the ajax script or not??
Jul 30 '08 #23
acoder
16,027 Expert Mod 8TB
Where's the code that makes the call to save into the database? Show the generated client-side version.
Jul 31 '08 #24
azura
47
it's ok.... it's already work!! thanks guys
Aug 1 '08 #25
acoder
16,027 Expert Mod 8TB
That's good news. Can you post what was causing the problem and how you solved it? Thanks.
Aug 1 '08 #26

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Lynn | last post by:
I'm running Oracle 8.1.7.4.1 on W2K and have the services for my oracle instances set to automatically startup and shutdown with the W2K server. Unfortunately, neither is working. Nothing gets...
6
by: Matt | last post by:
I have begun designing and programming in C++ after a several years away from software engineering/programming. I am looking for an "automatic C++ header generator." I have what seems to be...
2
by: hubert_s | last post by:
Hi, I have DB2 8.1 fixpack 7a on Win 2003 Srv, When I tried to enable automatic statistics I got the following error message: db2 update db cfg for SAMPLE using AUTO_STATS_PROF ON ...
2
by: David Richards | last post by:
Hi, Hopefully someone can help me. I have setup a continuous form that displays customer names and addresses. I have then place a txt box on the form header. Using the onChange event I've setup...
1
by: Mark | last post by:
I have a staff member with VS.NET 2002 who appears to have outlining (+ or - marks) permanently turned off. The option to "Start Automatic Outlining" is there, but it doesn't appear to do...
1
by: Jake | last post by:
Hi everyone, I have noticed when coding in c# that function commnets appear automaticly, is this possible when implementing in VB? Thanks an advance Jake
15
by: fbachri | last post by:
Hi, I have a form with 1 textbox in the header form area and data in continuous form style in detail area. i would like to make an automatic filter. so when i type a character the data in the...
4
by: Philip Nelson | last post by:
Folks, I've got a database and tablespaces "managed by automatic storage". I've deleted a lot of data from some tables. I've then reorged them. But the tablespaces don't appear to shrink...
58
by: Jorge Peixoto de Morais Neto | last post by:
I was reading the code of FFmpeg and it seems that they use malloc just too much. The problems and dangers of malloc are widely known. Malloc also has some overhead (although I don't know what is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.