SESSION or POST variable

  • Pop-Eye
  • Newbie
  • Newbie
  • Pop-Eye
  • Posts: 5

Post 3+ Months Ago

I have a php script that uses a variable to access corresponding records in a database. The variable is passed to it sometimes as a SESSION and sometimes via "POST" method. How can I check to see which technique was used to pass that variable to the php script?
Thanks
  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • User avatar
  • Posts: 3422
  • Loc: Richland, WA

Post 3+ Months Ago

You can use the isset() php function to check to see if a value was send via post.

PHP Code: [ Select ]
if( isset($_POST['var']) )
{
}
  1. if( isset($_POST['var']) )
  2. {
  3. }
  • Pop-Eye
  • Newbie
  • Newbie
  • Pop-Eye
  • Posts: 5

Post 3+ Months Ago

Thanks for quick reply. Work great. Thanks.
  • sandy_j_sam
  • Newbie
  • Newbie
  • sandy_j_sam
  • Posts: 9

Post 3+ Months Ago

HI, spoof told, i think same way, but I just want to add more, just see them as we know that in php we face no. of functions for testing the status of a variable. here we discuss isset(), which has the following prototype:
bool isset(mixed var);[;mixed var[,...]])
This function takes a variable name as an argument and returns true if it exists and false otherwise.
I think it' too good for understanding that's script.

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 42 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.