Very Urgent Passing Variables
Moderator: General Moderators
Very Urgent Passing Variables
How can i pass variables from pne php to another without submitting the form
- hypedupdawg
- Forum Commoner
- Posts: 74
- Joined: Sat Apr 10, 2010 5:21 am
Re: Very Urgent Passing Variables
Ummmm....? Do you mean two scripts in the same page? In which case all you need to do is declare variables outside the functions:
Or a different page altogether? in which case you can use the $_GET method by sending an URL such as "http://your.page.com/index.php?i=0&j=3" (i and j being the variables). you can then pick them up on the second page using:
Or on the same page, to an external script, without refreshing? In which case you need to investigate AJAX, using a combination of php and javascript.
A you can see, more details would help indefinitely
. Any reason why it's urgent?
Code: Select all
<?php
$i = 0;
function doStuff ()
{
//do something to $i
}
?>Code: Select all
<?php
$newvar = $_GET['i'];
$newvar2 = $_GET['j'];
?>A you can see, more details would help indefinitely
Re: Very Urgent Passing Variables
<input type="text" id="MARKET_PROVIDER_KY" name="PROVIDER_KY_MKT" b:required="true"/>
<b:button id="market_fetch_button">Fetch
<s:event b:on="command">
<s:task b:action="load" b:method="get" b:url="all/MarketingInputBdy.php" b:destination="id('Mkrtng_bdy')" b:mode="replace" />
<s:task b:action="show-hide" b:target="id('buttonDiv')" />
</s:event>
</b:button>
This is my code .....in the current php and am trying to execute the query defined in another php for which i need to pass the input type defined in my current php .And i am submitting my current php to
a different php .So i need to pass the input type value to the all/MarketingInputBdy.php .
<b:button id="market_fetch_button">Fetch
<s:event b:on="command">
<s:task b:action="load" b:method="get" b:url="all/MarketingInputBdy.php" b:destination="id('Mkrtng_bdy')" b:mode="replace" />
<s:task b:action="show-hide" b:target="id('buttonDiv')" />
</s:event>
</b:button>
This is my code .....in the current php and am trying to execute the query defined in another php for which i need to pass the input type defined in my current php .And i am submitting my current php to
a different php .So i need to pass the input type value to the all/MarketingInputBdy.php .
- hypedupdawg
- Forum Commoner
- Posts: 74
- Joined: Sat Apr 10, 2010 5:21 am
Re: Very Urgent Passing Variables
You've defined the method as "get" and I presume the id is "'Mkrtng_bdy' - so on your recieving page, you need to have a statement like this:
I don't understand what your first query was about - not submitting the form? Could you please elaborate? For either of these methods, you need to submit the form for it to work. Otherwise, you will need to use an AJAX method.
Code: Select all
$newVar = $_GET['Mkrtng_bdy'];- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
Re: Very Urgent Passing Variables
It's still not clear, but you might be looking for Sessions
http://us3.php.net/manual/en/book.session.php
http://us3.php.net/manual/en/book.session.php