Hi
I have a couple of php file that run separately, but I want to make them work together, how can I get the $val1 value from file1 to file2 so that $val1 can be used in the the second file?
Getting a value from another file
Started by sergo, Oct 19 2009 01:12 PM
5 replies to this topic
#1
Posted 19 October 2009 - 01:12 PM
|
|
|
#2
Posted 19 October 2009 - 01:21 PM
There are methods:
1) if they link to eachother, by the link, add "?var=value" to the other filename
2) if same user uses them both, store in a session variable
3) store value in a file on disk
4) store value in a database
and there are maybe even more
1) if they link to eachother, by the link, add "?var=value" to the other filename
2) if same user uses them both, store in a session variable
3) store value in a file on disk
4) store value in a database
and there are maybe even more
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall
I study Information Systems at Karlstad University when I'm not on CodeCall
#3
Posted 19 October 2009 - 05:03 PM
the simple way is store the value on database, you need to
1. create database
2. create table
3. store the value
for get the value you can use SELECT mysql :)
good luck
1. create database
2. create table
3. store the value
for get the value you can use SELECT mysql :)
good luck
#4
Posted 20 October 2009 - 05:57 AM
how do I link them each other?var=value"
#5
Posted 20 October 2009 - 06:05 AM
just a link:
then read it in file2 with $_GET['var']
echo "<a href='file2.php?var=".$valuetosend."'>link to page 2</a>";
then read it in file2 with $_GET['var']
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall
I study Information Systems at Karlstad University when I'm not on CodeCall
#6
Posted 20 October 2009 - 06:56 AM
I want to use this to search a data base but it is very confusing because I have several problems.
Edited by sergo, 22 October 2009 - 07:15 AM.


Sign In
Create Account

Back to top









