Jump to content

[SOLVED] PHP $_GET from a URL


Richter12x2

Recommended Posts

I did some searching and haven't been able to find any useful information.  I have a simple page that I'm trying to use as a shortcut for activating a user in a SQL database, but I can't seem to capture the variable.  I've found 5 or 6 pages now that say "This is how you do it" but obviously I'm missing something. 

 

Whenever the page is called - "activate.php?user_id=27" it displays "There has been an error processing your request" so I added the echo statements to confirm the variable is blank, and nothing prints, so it is.  If I manually set the variable $user_id = '27' then it processes perfectly.  What am I missing?

 

Here's the entire text of the page -

<? require("../dbsql.php");

$user_id = $_get['user_id'];
echo $_get['user_id'];
echo $user_id;



if ($user_id != '')
{
$sqlcUseredit="update userinfo set status ='A' where user_id=$user_id";
dbSQLinsert($sqlcUseredit);
echo $user_id." activated!";
}
else
{
echo "There has been an error processing your request.";
}
?>

Link to comment
https://forums.phpfreaks.com/topic/68862-solved-php-_get-from-a-url/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.