variable scope problem
Posted: Mon Oct 22, 2007 9:07 am
I want the value of the variable $user to go inside the if statement inside the query, but its not working.
How can i make the value of the variable $user as a global for access inside if....else block statements.
I have a dropdown menu which has a link as http://localhost/xampp/......../myfile?id=AddPaper
when i click the button the above if statement is executed but the value of the variable $user isn't coming inside it and before the button click i have a value inside the link as http://localhost/xampp.......myfile?user=$_post[name].
I hope you get what i want to say.
How can i make the value of the variable $user as a global for access inside if....else block statements.
Code: Select all
$val = $_GET['id'];
$user = $_GET['user'];
if ($val == "AddPaper" && !isset($_POST['next_x'])){
//echo "$user";
$sql="SELECT programe_name FROM teachers WHERE teacher_name='$user' ";
$result = mysql_query($sql, $conn) or die ("Can't Process Query".mysql_query());
while ($row=mysql_fetch_array($result)){
$add1 .= "<option value='$row[programe_name]'>$row[programe_name]</option>";
}I have a dropdown menu which has a link as http://localhost/xampp/......../myfile?id=AddPaper
when i click the button the above if statement is executed but the value of the variable $user isn't coming inside it and before the button click i have a value inside the link as http://localhost/xampp.......myfile?user=$_post[name].
I hope you get what i want to say.