i have this php code
<?php
include "confiq.php";
$username = $_REQUEST['username'];
echo $username;
?>
when i run this code it gives me this error as :
Notice: Undefined index: username
iam new to php and i did some searching and all of them used isset to eliminate this error ... but i need to define this one because i will use it to get info in profile page so , how i can define my username so i can print it on the screen ?!!!
EDIT : i tryed the $_GET and it gives me the same error and my include file has no miss writing too idk how i can get this to work i need to read the user name and other data from database to display them in profile page but this error is annoying ... plus it didnt show up in the tutorials i saw ... the same code worked perfectly
EDIT: i also tried this code
if (isset($_GET['username']))
{
$username = $_GET['username'];
$userquery = mysql_query("SELECT * FROM userdata WHERE username = '$username'") or die ('cant find the query');
if (mysql_num_rows($userquery) != 1)
{
die ("this profile can not be found");
}
while($row = mysql_fetch_array($userquery, MYSQL_ASSOC))
{
$username = $row['username'];
}
}
else die ("specify username again");
and in the profile where i should display the user name it show me the msg (specify username again) that means it didnt even go throw the first if in my code now what x_x !!