Jump to content


Photo

How Can I post a value without using a form


  • Please log in to reply
2 replies to this topic

#1 Hardwarez

Hardwarez
  • Members
  • PipPipPip
  • Advanced Member
  • 37 posts

Posted 13 October 2006 - 02:25 PM

Ok, my proram is working off post data.  I have run into a place where I need to be able set a post name and value without using a form.  How can I do that?

I catch submitted forms like this:
if ($_POST['looking'] == 'Button A') dosomething();

So how do I set a post value named looking to "myValue"?
Without a button or form..


#2 akitchin

akitchin
  • Staff Alumni
  • Advanced Member
  • 2,516 posts
  • LocationCalgary, AB, Canada

Posted 13 October 2006 - 02:27 PM

simple:

$_POST['looking'] = 'myValue';

superglobals are ALWAYS initiated, whether they contain anything or not.  that means you are always able to add values to them dynamically without having to force the engine to initiate them.

#3 Hardwarez

Hardwarez
  • Members
  • PipPipPip
  • Advanced Member
  • 37 posts

Posted 13 October 2006 - 03:30 PM

GR8!  Thank you..
:)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users