cromagnon Posted December 28, 2007 Share Posted December 28, 2007 Hi Freaks I am a newbie, and have a simple problem. I just made a form and an action wich calls a new page "site.php". On this new page I call the value in the form by get: <? $websted=$_GET['websted']; echo "<p><b>$websted</b></p>";?> Everything is ok, but now I like the user to fill out another form wich call a new page "site1.php" On this new page I like to call both the formvalue from the first page and the formvalue from the second page. <? $websted=$_GET['websted']; $hi=$_GET['hi']; echo "<p><b>$websted</b></p>"; echo "<p><b>$hi</b></p>";?> BUT it seems impossible since the first value seems to be forgotten! How can I call both the first and the second formvalue? How can I transfer the first value to the last page? Thanks! Cromagnon Quote Link to comment https://forums.phpfreaks.com/topic/83465-how-to-call-an-old-value/ Share on other sites More sharing options...
monkeytooth Posted December 28, 2007 Share Posted December 28, 2007 The easiest way to transfer over is take your <? $websted=$_GET['websted']; echo "<p>$websted</p>";?> and make a hidden form value to submit with the form on site.php into site1.php in other words in your case.. <input type="hidden" name="websted" value="<?php echo $websted; ?>"> make sure its in between your <form></form> and should transfer onto site1.php no problem.. just call it the same way you did with site.php and make sure its a form field on site.php is a diffrent name from your hidden value Quote Link to comment https://forums.phpfreaks.com/topic/83465-how-to-call-an-old-value/#findComment-424646 Share on other sites More sharing options...
cromagnon Posted December 28, 2007 Author Share Posted December 28, 2007 Thank you! I was actually trying to do that, but I just tried like this value=$websted, wich did not work. Thanks again Quote Link to comment https://forums.phpfreaks.com/topic/83465-how-to-call-an-old-value/#findComment-424652 Share on other sites More sharing options...
papaface Posted December 28, 2007 Share Posted December 28, 2007 The easiest way is to use sessions: session_start(); $_SESSION['hi'] = $_GET['hi']; Then later on session_start(); echo $_SESSION['hi']; easy Quote Link to comment https://forums.phpfreaks.com/topic/83465-how-to-call-an-old-value/#findComment-424655 Share on other sites More sharing options...
revraz Posted December 28, 2007 Share Posted December 28, 2007 I would use a session also. Quote Link to comment https://forums.phpfreaks.com/topic/83465-how-to-call-an-old-value/#findComment-424657 Share on other sites More sharing options...
Daniel0 Posted December 28, 2007 Share Posted December 28, 2007 Just noticed you use a GET value and a variable in Danish, so here is a word of advice: It's better to have your variable and function names in English. They must be named like this (regex): ^[_a-zA-Z][_a-zA-Z0-9]*$ (i.e. it must only contain the letters a through z (upper case and lower case), an underscore and digits and it must start with an underscore or one of the before mentioned letters) and at some point you might need to use a name where the allowed characters are not sufficient. Quote Link to comment https://forums.phpfreaks.com/topic/83465-how-to-call-an-old-value/#findComment-424694 Share on other sites More sharing options...
monkeytooth Posted December 28, 2007 Share Posted December 28, 2007 Session would be better deffinately agree'd but only reason I mentioned it the way is some service providers either block sessions, or make them a pain in the arse to do.. or atleast with experiances I have had in the past, my way is a work around but not nessisarily the best in this senerio, if you have session ability Quote Link to comment https://forums.phpfreaks.com/topic/83465-how-to-call-an-old-value/#findComment-424935 Share on other sites More sharing options...
revraz Posted December 28, 2007 Share Posted December 28, 2007 I haven't seen any of them block them, but I have seen the PHP.INI setup incorrectly by them. Session would be better deffinately agree'd but only reason I mentioned it the way is some service providers either block sessions, or make them a pain in the arse to do.. or atleast with experiances I have had in the past, my way is a work around but not nessisarily the best in this senerio, if you have session ability Quote Link to comment https://forums.phpfreaks.com/topic/83465-how-to-call-an-old-value/#findComment-424936 Share on other sites More sharing options...
monkeytooth Posted December 28, 2007 Share Posted December 28, 2007 yahoo, and even godaddy blocked them for awhile I dunno bout anymore.. but did.. IXWebhosting for awhile to.. Quote Link to comment https://forums.phpfreaks.com/topic/83465-how-to-call-an-old-value/#findComment-424939 Share on other sites More sharing options...
papaface Posted December 28, 2007 Share Posted December 28, 2007 Session would be better deffinately agree'd but only reason I mentioned it the way is some service providers either block sessions, or make them a pain in the arse to do.. or atleast with experiances I have had in the past, my way is a work around but not nessisarily the best in this senerio, if you have session ability Then people hosted by companies like that should switch because using hidden form fields is a potential security risk. Quote Link to comment https://forums.phpfreaks.com/topic/83465-how-to-call-an-old-value/#findComment-424954 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.