Is there an equal VBScript solution to PHP's
$_POST("user") = 12345;
I just need to set the $_POST variable to some value (which gets retrieved on the next page) and do not see any direct solution. ( note: I cannot use session, or self-submitting html form with post method.)
Thanks.
Related
When we receive a Request object in Laravel, is there a way to modify or add data to it? For instance, could I rename a parameter (not the value, but the parameter name itself) to something else? For example, the input might be called fname but I want to change it to first_name. Or could I add new inputs and values that weren't in the original request?
The reason I ask is that I have a method that accepts a Request object, and expects certain input names. I'd like to be able to reuse the method, but the request input names will be different.
If you have an Object you can edit and add new items.
$request->url = $new_url;
$request->new_item = 1;
If the object item not exists, then will create automatically, or if it exists, will modify it.
Tested #marc-garcia answer, and that will not persist through your script execution. This will...
// merge defaults into the request.
// this makes it consistent everywhere (blade, controller...)
request()->merge([
// find the request if it exists, second param is the default value
'reservable' =>request( 'reservable', (self::RESERVABLE_BY_DEFAULT?1:0) )
]);
You may also use request()->replace([...]); but that will remove all other parameters from the request and replace it will the array you provide.
Since the system I am using has Login and Logout feature, I am inside Session when I Logs in to the system. I am new to Session, my question is whatever variable and its value I have defined in any coldfusion page, would I be able to use it on any page?
For example, while going through the code of my system, I came across the following line one each and every CFML page:
<cfparam name="INPUTID" default="0">
and then later on somewhere in the page, I have seen this variable getting used like #INPUTId# .
Please clarify
To answer the question "whatever variable and its value I have defined in any coldfusion page, would I be able to use it on any page" ... that depends.
If you set a session variable e.g. <cfset session.foo = "bar" > then you can call #session.foo# on any page since it will be stored in the user's session.
However if you simply set a value, e.g. <cfset foo="bar" > then it will end up in the 'variables' scope and only available within that page, or request. (on that note, CF has a specific "request" scope, e.g. request.foo, which is for this purpose, available throughout any code that comes after the place where the value is set, in the same request or page view).
So, if you want to set values that can be used on other pages, use the session. But be careful, you will also need to use cfparam to set defaults, or use structKeyExists() to check for the value, before trying to call it from the user's session, since the value may not exist unless it has been set already. Otherwise, for values used in the same page, use the 'request' scope, or see the CF docs for other scopes e.g. variables, local, etc.
I have a problem, when I make a AJAX request to retrieve more data a session variable called is_logued which indicates is the current user is logged in the system lose its value.
I have test it with the rest of the page and it is ok, no problems. The problem comes when the ajax request is sent.
I have make a debug in the Session class, but I cannot find anything strange. I make a print_r to the values and the variable is correctly set inside the Session Class. Moreover the values are stored in the database in the CI_SESSIONS table.
Anyone knows what is happening? Is there any process that writes in the session table without using the Session library? It is very strange because only is_logued lose its value. I have check is I do it manually but does not. Nobody calls unset to that variable.
More information
public function load_next_links($param)
{
$this->load->helper('principal_helper');
echo "is_logued value ".$this->session->userdata("is_logued");
echo get_next_links($param);
echo "is_logued value ".$this->session->userdata("is_logued");
}
In both cases is_logued value has the correct value 1. This function is located in the principal controller. But after the call the database has the value 0. Why?
More data:
I have print the values in the database in the last line of the CodeIgniter.php (core) and the bbdd has the good value! why when I saw the database the value is not the correct? where is this value being changed?
I want to access a variable sent through url in the view of a joomla component. How can I achieve it? Please help me.
you can use
$myvar = JRequest::getVar('variablename','defaultvalue') ;
or (only in J1.6+)
$jinput = new JInput();
$myvar = $jinput->getVar('myvar');
There are more methods to JRequest and JInput i.e. JRequest::getInt, getCmd etc you might want to check the docs.joomla.org
With both you can choose to restrict the method from which the values are read, pass 'GET' as a third parameter to any getVar function and the value will be read only if it's from a GET, otherwise you can test COOKIE, POST etc.
I am using a template which calls a function in block, and inside that block I am trying to pull a current category with Mage::registry('current_category'). However it always returns NULL. I've tried doing this from product page, search page - still nothing. Is there any reason why it would return NULL, what are some things I could check?
It's null because it's not set. The registry acts as a system for global variables that don't rely on PHP's built in global support. It is not guaranteed that any particular variable that's been registered will be available on every page. For example, you said you tried this on the search page. What should the current_category be on the search page?
It's null because it's supposed to be.
Try this:
$category = $this->helper('catalog/category')->getCategoryUrl(Mage::registry('current_category'));