473,808 Members | 2,792 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to transfer the variable to next page?

The first page have the pre-define variable. How to transfer to next
php page?
Thanks

May 20 '06 #1
8 5963
Alex Murphy wrote:
The first page have the pre-define variable. How to transfer to next
php page?
Thanks


Hi Alex,

You can do so in different ways.
If you make a link to the next page, you can pass it via the URL:
http://www.mysite.com/nextpage.php?myvar=23

You can also store the variable in a session.
Look up SESSION at www.php.net to get started.
($_SESSION[] is per-user.)

You can also store the variable somewhere on a database or in a file.

What is the best way completely depends on what you are trying to achieve,
but you didn't tell us a lot.

Regards,
Erwin Moller
May 20 '06 #2
Its work...!!

Thanks Erwin

May 21 '06 #3
Erwin Moller wrote:
Alex Murphy wrote:
The first page have the pre-define variable. How to transfer to next
php page?
Thanks


Hi Alex,

You can do so in different ways.
If you make a link to the next page, you can pass it via the URL:
http://www.mysite.com/nextpage.php?myvar=23

You can also store the variable in a session.
Look up SESSION at www.php.net to get started.
($_SESSION[] is per-user.)

You can also store the variable somewhere on a database or in a file.

What is the best way completely depends on what you are trying to
achieve, but you didn't tell us a lot.

Regards,
Erwin Moller


Or if doing a post, you can store it in a hidden input field.
May 21 '06 #4
But... how to post a predefined variable?

May 21 '06 #5
Alex Murphy wrote:
But... how to post a predefined variable?


The first step is to get php to send the predefined value to the web
browser. This may be done using SESSIONs.

session_start() ;
$_SESSION['predefined'] = $predefined;
session_write_c lose();
header('Locatio n: first_page.php' );

Then, in first_page.php, you get the predefined value back and place it
into a POST value.

session_start() ;
<form action="second_ page.php" method="POST">
<input type="hidden" name="predefine d" value="<?php echo
$_SESSION['predefined'];?>">
</form>

Now, the value of 'predefined' is available to second_page.php as a
$_POST value.

$predefined = $_POST['predefined'];

Does this help?

-david-

May 21 '06 #6
Thanks David, it is very useful for me. I never know PHP can do that.
Thanks again.

May 22 '06 #7

Alex Murphy wrote:
The first page have the pre-define variable. How to transfer to next
php page?
Thanks


Use Sessions or write text files in a temporary location. Sessions are
better.

May 23 '06 #8
David Haynes wrote:
Alex Murphy wrote:
But... how to post a predefined variable?


The first step is to get php to send the predefined value to the web
browser. This may be done using SESSIONs.

session_start() ;
$_SESSION['predefined'] = $predefined;
session_write_c lose();
header('Locatio n: first_page.php' );

Then, in first_page.php, you get the predefined value back and place
it into a POST value.

session_start() ;
<form action="second_ page.php" method="POST">
<input type="hidden" name="predefine d" value="<?php echo
$_SESSION['predefined'];?>">
</form>

Now, the value of 'predefined' is available to second_page.php as a
$_POST value.

$predefined = $_POST['predefined'];

Does this help?

-david-

But if he simply wants to carry a value from one page to the next and he is
doing it via a hidden field in a post, does he really need the session?
Jun 13 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2364
by: weiwei | last post by:
Hi all I am having trouble, let's say, I have a form text field, and I want to pass it to the next page, however, I don not want to use submitted button, instead I want to have a variable in link and pass that variable to the next page see below code <form name="form1" method="post" action=""> name
2
2221
by: Al Cadalzo | last post by:
I am doing a screen-scraping app using HttpWebRequest. I create the HttpWebRequest and then I call the GetResponse() method on it. I get the page back OK. The page has a 'Next' button on it. I want to get the next page by "clicking" the 'Next' button on the Web page using the HttpWebRequest. Is that possible to do? I looked at the html from the response and the 'Next' button is:
4
3718
by: meenu_susi | last post by:
i have different colors for shirt... When I click the blue color the shirt color will change to blue color and Near to that shirt I will have a button as design now when I click that button it get posted To next page where I want the changed shirt color to be displayed(as I told when I click blue the shirt will change to blue that blue shirt has to be displayed in next page when I click the button) Then the script is as follows ...
1
1271
by: rich2912 | last post by:
I have a page, with three drop down boxes. Each has four choices linked to a database. Here is what I would like to do: I would like the results of the three choices, to be displayed on the next page, after the submit button is clicked. I have searched here, but am unfamiliar with the terminolgy for this kind of feature. Any help, or example code would be great.
14
2660
by: fjm | last post by:
Hi all.. I'm back with another problem that I just can't seem to solve. I have dynamically generated hyperlinks that are created from a while loop in tabular format. Each hyperlink should take the user to the next page by way of a session with THAT generated link. (I really don't want to use GET for this) That links generated value must be used to pass to the next page. Depending on what that number is will determine what will be...
5
2176
by: phanimadhav | last post by:
Response.Redirect("explain.aspx?firstimportname="+filename); This is my statement.In this statement i am sending only single value to next page.but i want to pass multiple values by using multiple fields(firstimportname )to next page.please suggest me .please send the replay as early as possible thank u.
9
1585
by: shaiful | last post by:
Hi all, I have a problem to transfer variable from one Form to other Form, such as Form1: command_button1() dim a as string a="Hello world!" Form2.show() I want to see the "Hello World!" on Form2 after pressing command button1 on Form1
2
2013
by: ravisuguna | last post by:
Hi, I have a php page which has some checkboxes ,textfields and values.If I select a checkbox ,a particular value will be displayed in a textfield.I have a "go"button in the same page.I want the selected values and textfields to be displayed in the next page if i click the button.Pl guide me how to do this. I am sending the sample code below. arical.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
4
3887
by: madhumy | last post by:
I am having Arraylist containg list of data, Now I am using a Session variable concept to Pass the Arraylist to next page, Instead I want to use Querystring method, can it be done? I need code help.
0
10373
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10374
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10113
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7651
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6880
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5547
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5685
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4331
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3011
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.