musk
07-01-2007, 01:43 PM
THIS IS MY HTML FILE
can some one help me please
<?PHP
extract( $_POST );
?>
<!------------------------------------------------------------------------------------------*
THE WELCOME PAGE
*------------------------------------------------------------------------------------------->
<html>
<head>
<title> CLC-City of London College </title>
<link rel="stylesheet" type="text/css" href="style.css" />
<script type="text/javascript">
/*===========================CHANGE THE COLOR OF TEXT ON MOUSE OVER========================*/
function changefontcolor(ref, fontcolor){
ref.style.color=fontcolor;
}
/*==========================CHANGE THE COLOR OF TEXT ON MOUSE CLICK========================*/
function changecoloronclick(fontcolor){
document.fgColor = fontcolor;
}
/*=========================================================================================*/
/////////////////////////////////////////////////////////////////////
function showStudent()
{
xmlHttp=GetXmlHttpObject()
alert("you are in the show student function")
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
var a = "122013";
var url="myprofile.php"
url=url+"?q="+a
url=url+"&sid="
alert("you are near to exit")
xmlHttp.onreadystatechange=stateChanged()
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
/////////////////////////////////////////////////////////////////////
function stateChanged()
{
alert("you are in the state change function")
if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete")
{
alert("you are in if condition")
document.getElementById("txtHint").innerHTML=xmlHttp.responseText
}
else if (xmlHttp.readyState == 1 )
{
alert("your request has been setup");
}
else if (xmlHttp.readyState == 2 )
{
alert("your request has been send");
}
else if (xmlHttp.readyState == 3 )
{
alert("your request is in progress ");
}
else if (xmlHttp.readyState == 0 )
{
document.getElementById("txtHint").innerHTML=xmlHttp.responseText
alert("your request has not been initialized");
}
}
/////////////////////////////////////////////////////////////////////
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>
</head>
<body>
<div id="page">
<div id = "head">
<table class = table1>
<tr>
<td align = "center">
<img src="Image/logo.gif" alt="logo"></img>
</td>
</tr>
</table>
</div>
<div id = "left">
<b>
</br>
<a onmouseover= "changefontcolor(this, 'blue')" onmouseout="this.style.color='black'" href="javascript:void(0)" onclick="showStudent()" id = dec>
  ¬ My Profile</a>
<hr color= #FFFFFF size = 10 width =100% >
<a onmouseover= "changefontcolor(this, 'blue')" onmouseout="this.style.color='black'" href="javascript:void(0)" id = dec>
  ¬ Download Past Papers</a>
<hr color= #FFFFFF size = 10 width = 100% >
<a onmouseover= "changefontcolor(this, 'blue')" onmouseout="this.style.color='black'" href="javascript:void(0)" id = dec>
  ¬ Lecture Material</a>
<hr color= #FFFFFF size = 10 width = 100% >
</b>
</div>
<div id = "middle">
<p><div id="txtHint"><b>User info will be listed here.</b></div></p>
</div>
</div>
</body>
</html>
This is my PHP File
<?PHP
echo "You are here";
$q =$_GET["q"];
$username="";
$password="";
$database="college";
$con = mysql_connect(localhost,$username,$password);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
@mysql_select_db($database, $con);
$query = "Select * from students";
$result = mysql_query($query);
$num = mysql_numrows($result);
$fname = mysql_result($result,0,"STUDENT_FIRST_NAME");
echo "$fname";
mysql_close($con);
?>
can some one help me please
<?PHP
extract( $_POST );
?>
<!------------------------------------------------------------------------------------------*
THE WELCOME PAGE
*------------------------------------------------------------------------------------------->
<html>
<head>
<title> CLC-City of London College </title>
<link rel="stylesheet" type="text/css" href="style.css" />
<script type="text/javascript">
/*===========================CHANGE THE COLOR OF TEXT ON MOUSE OVER========================*/
function changefontcolor(ref, fontcolor){
ref.style.color=fontcolor;
}
/*==========================CHANGE THE COLOR OF TEXT ON MOUSE CLICK========================*/
function changecoloronclick(fontcolor){
document.fgColor = fontcolor;
}
/*=========================================================================================*/
/////////////////////////////////////////////////////////////////////
function showStudent()
{
xmlHttp=GetXmlHttpObject()
alert("you are in the show student function")
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
var a = "122013";
var url="myprofile.php"
url=url+"?q="+a
url=url+"&sid="
alert("you are near to exit")
xmlHttp.onreadystatechange=stateChanged()
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
/////////////////////////////////////////////////////////////////////
function stateChanged()
{
alert("you are in the state change function")
if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete")
{
alert("you are in if condition")
document.getElementById("txtHint").innerHTML=xmlHttp.responseText
}
else if (xmlHttp.readyState == 1 )
{
alert("your request has been setup");
}
else if (xmlHttp.readyState == 2 )
{
alert("your request has been send");
}
else if (xmlHttp.readyState == 3 )
{
alert("your request is in progress ");
}
else if (xmlHttp.readyState == 0 )
{
document.getElementById("txtHint").innerHTML=xmlHttp.responseText
alert("your request has not been initialized");
}
}
/////////////////////////////////////////////////////////////////////
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>
</head>
<body>
<div id="page">
<div id = "head">
<table class = table1>
<tr>
<td align = "center">
<img src="Image/logo.gif" alt="logo"></img>
</td>
</tr>
</table>
</div>
<div id = "left">
<b>
</br>
<a onmouseover= "changefontcolor(this, 'blue')" onmouseout="this.style.color='black'" href="javascript:void(0)" onclick="showStudent()" id = dec>
  ¬ My Profile</a>
<hr color= #FFFFFF size = 10 width =100% >
<a onmouseover= "changefontcolor(this, 'blue')" onmouseout="this.style.color='black'" href="javascript:void(0)" id = dec>
  ¬ Download Past Papers</a>
<hr color= #FFFFFF size = 10 width = 100% >
<a onmouseover= "changefontcolor(this, 'blue')" onmouseout="this.style.color='black'" href="javascript:void(0)" id = dec>
  ¬ Lecture Material</a>
<hr color= #FFFFFF size = 10 width = 100% >
</b>
</div>
<div id = "middle">
<p><div id="txtHint"><b>User info will be listed here.</b></div></p>
</div>
</div>
</body>
</html>
This is my PHP File
<?PHP
echo "You are here";
$q =$_GET["q"];
$username="";
$password="";
$database="college";
$con = mysql_connect(localhost,$username,$password);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
@mysql_select_db($database, $con);
$query = "Select * from students";
$result = mysql_query($query);
$num = mysql_numrows($result);
$fname = mysql_result($result,0,"STUDENT_FIRST_NAME");
echo "$fname";
mysql_close($con);
?>