i am new to php, i am getting error as :
Notice: Undefined index: userID in echo "<a href='home.php?userID=".$row['userID'] . "'>".$row['userName']." ".$row['userEmail']."</a><br/>";
home.php
$sql = 'SELECT userName, userEmail FROM tbl_users';
$stmt = $dbCon->prepare($sql);
$stmt->setFetchMode(PDO::FETCH_ASSOC); //allows you to refer to them by column name rather than by number
$stmt->execute();
while ($row = $stmt->fetch())
{
echo "<a href='home.php?userID=".$row['userID'] . "'>".$row['userName']." ".$row['userEmail']."</a><br/>"; //builds the link
}
i followed this link and add the below code in home.php & signup.php , but it didt worked for me, where i done mistake ?
//Initializing variable
$userID = "";
//isset()
$userID = isset($_POST['userID']) ? $_POST['userID'] : '';
//empty()
$userID = !empty($_POST['userID']) ? $_POST['userID'] : '';
Edit
this question is not duplicate because i followed the answer in that link, but it did't worked for me.