Hi All
I am kinda new to php.... I am entering in the website using student id. If student id does not exist in mysql database, it gives me error. That works fine.
But If I try to echo StudentID on 2nd page, it is not displaying anything. Second problem is I want to display student first and last name using StudentID. But it is not displaying anything using StudentID. Why? I have been trying to solve it, but no success

Following is the code for both problems -
if(!$db_selected)
{
die("Can not use".DB_NAME.':'.mysql_err());
}
@$Stud_ID = $_POST['Stud_ID'];
?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<link rel="stylesheet" type="text/css" href="ACSDP.css" />
<title>Student Main Page</title>
<head><h1>Welcome to Undergraduate Student Main Page</h1>
</head>
<body>
<form name ="mainpage" method='POST'>
<table>
<tr>
<td><label id="Stud_ID2" for="Stud_ID"> Student ID <?php echo "is:" ." ". @$Stud_ID; ?> </label></td>
<td> <label id="degree">Degree: Computer Science</label></td>
</tr>
<tr>
<td> <label id="name"> Student Name: <?php
$query2 =mysql_query("SELECT Stud_Lastname, Stud_Firstname FROM Student WHERE Stud_ID='$Stud_ID'") or die('wrong query'.mysql_error());
while($row = mysql_fetch_array($query2))
{
echo $row['Stud_Lastname'] . " " . $row['Stud_Firstname'];
} Moderator Edit (jSherz): Placed code into PHP tags and then put the statements in bold below:
If have made those statements bold.<?php echo "is:" ." ". @$Stud_ID; ?>$query2 =mysql_query("SELECT Stud_Lastname, Stud_Firstname FROM Student WHERE Stud_ID='$Stud_ID'") or die('wrong query'.mysql_error());