|
#1
|
|||
|
|||
|
asp or php passing variables? not related to AMS but you guys always seem to know :ye
Hi guys,
I am trying to pass variables through my pages it can be asp or php, I have managed to pass "fname" to the next page but I would like page2 which retrieves this information to store it in a hidden field so that I can pass it to another page, any ideas on how to do this? Thanks guys Last edited by ianhull; 06-10-2005 at 05:21 AM. Reason: Spelling mistakes |
|
#2
|
||||
|
||||
|
If it's in a form, that's easy. So for example our original link which leads from page 1 to page 2 might be:
http://www.yoursite.com/page1.php?name=Joe Then on page 2 you simply add this to your HTML form: <input type="hidden" name="name" value="<?php echo $name; ?>"> |
|
#3
|
||||
|
||||
|
Just off the cuff, I think a 'global function' should be able to handle that.
|
|
#4
|
|||
|
|||
|
Excellent Corey, Once agin you are the man!
And thanks for that Rhosk, I will look into that. Thanks again guys. |
|
#5
|
||||
|
||||
|
Once again, Corey is quick on the fly. He mentioned that you were "talking web pages". That's what I get for reading/replying too quick. I was thinking too deep. Need more java I guess.
|
|
#6
|
|||
|
|||
|
Hi again,
I seem to be having a little trouble with this one. I can post to the first page which is called welcome.php but I cannot seem to post to welcome2.php as I have an error on line 5 I cannot seem to work it out. <html> <body>Welcome <?php echo $_POST["name"]; ?>.<br /> </body> <form action="welcome2.php" method="POST"> <input type="hidden" name="name" value="<?php echo $name; ?>"> <input type="submit" /> </form> </html> Any more help will be greatly appreciated. Thanks |
|
#7
|
||||
|
||||
|
Hi. In that case just use:
<input type="hidden" name="name" value="<?php echo $_POST["name"]; ?>">
|
|
#8
|
|||
|
|||
|
Excellent Corey. Thanks again. |
|
#9
|
||||
|
||||
|
Glad to help.
|
|
#10
|
|||
|
|||
|
Hi again guys,
I just have a little question about php and storing everything globally I have used a include function on evey page and I am wondering if I enter my name and then retrieve it on page 3, then on page 4 if I have another input box which uses the var name "name" again wil it overwrite the stored var? Thanks guys, and Ron thanks for your suggestion on globals it does keep everything nice and tidy and it is easier to learn with. |
|
#11
|
||||
|
||||
|
Yes it will, you can only use each variable name once if you wish the value to hold, or at least you would have to shift the value to another variable/array if you want to keep it but re-use the variable name.
![]() It's the same as in AMS if you replace a variable value, the first one is lost, i.e.: name = "Joe"; name = "Bob"; Will result in the variable called "name" containing the value "Bob". "Joe" is lost forever unless you shift it somewhere else, i.e. names={}; name = "Joe"; names[1] = name; name = "Bob"; names[2] = name; Would result in the variable "name" containing the value "Bob" but the table "names" containing both "Joe" and "Bob"... Hope that helps.
|
|
#12
|
|||
|
|||
|
Hey that's excellent Corey,
I did not know I could do that with the tables, You just saved me loads of time again. Thank you very much |
|
#13
|
||||
|
||||
|
No problem, for even more check out the free video on "Tables Made Easy" at:
http://www.speedytraining.com/site/cd3.php |
![]() |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| php question Not related to AMS | ianhull | Developer's Den | 4 | 06-07-2005 07:23 AM |
| Help passing screen variables | swilk | Setup Factory 7.0 Discussion | 2 | 12-06-2004 12:07 PM |
All times are GMT -6. The time now is 01:30 PM.








Linear Mode

