I am trying to get the parameter from my URL. This is how it looks http://localhost/project1/post.php?subtopic_id=3
. This is how I get the parameter from the URL
$subtopic_id = isset($_GET['subtopic_id']) ? $_GET['subtopic_id'] : 3 ;
When I put a number in the else statement (like I currently have the number 3 in it) I get that number. But when I have the else statement blank the only number that shows up in the DB is 0. I don't know why this is happening even though the parameter in the URL has a value in it.
When the code is like this and I try to add a comment to my post the subtopic_id value is 0 when it's suppose to have a different number
$subtopic_id = isset($_GET['subtopic_id']) ? $_GET['subtopic_id'] : '' ;