php post/get/request help?

  • Thread starter Thread starter ash
  • Start date Start date
A

ash

Guest
It is probably going to be clear to you that I don't know much about php, because there is probably an easy fix for this..

but i'm working on a project where i need to make a forum, and an admin gets certain priveleges .. if they click on createuser, i'm trying to send to select that they clicked that .. but i'm doing something wrong..

so i have this in my php code, where the admin can click on a link to create users
print "<a href='?select=createUsers'>Create Users<br></a>"

and i also have
if ($_REQUEST['createUsers']) {
.........
}

should i be using post or get? neither of them work tho .. i think i'm just missing the logic behind this somehow
 
As the link is with:
?select=createUsers

the request type is $_GET (should work with $_REQUEST as well, but having this option active in PHP is unsafe and NOT recommended, it's always best to use the proper source array, instead of the REQUEST which merges together GET, POST and cookies).

But your mistake is that you used the wrong name. Take a look at the link: it says select=createUsers. Isn't obvious that the variable name is 'select' and the value is 'createUsers' ? The right way to access the value is $_GET["select"], which will have the value "createUsers"
 
Back
Top