djcritch Posted March 18, 2008 Share Posted March 18, 2008 hi i have an HTML form a.html which uses the GET method that goes to a.php? . . . . . . my problem is i need to echo this information in b.php and c.php as well is this possible? if so can anyone explain how i can do this? cheers dave. Link to comment https://forums.phpfreaks.com/topic/96743-php-echo-problems/ Share on other sites More sharing options...
conker87 Posted March 18, 2008 Share Posted March 18, 2008 Could we see your code. Link to comment https://forums.phpfreaks.com/topic/96743-php-echo-problems/#findComment-495072 Share on other sites More sharing options...
frijole Posted March 18, 2008 Share Posted March 18, 2008 using sessions... session_start(); $_SESSION['variableName1'] = $_POST['variableName1']; $_SESSION['variableName2'] = $_POST['variableName2']; $_SESSION['variableName3'] = $_POST['variableName3']; $_SESSION['variableName4'] = $_POST['variableName4']; Link to comment https://forums.phpfreaks.com/topic/96743-php-echo-problems/#findComment-495077 Share on other sites More sharing options...
revraz Posted March 18, 2008 Share Posted March 18, 2008 Or, since you are using GET, you can just pass those variables along in the URL. Link to comment https://forums.phpfreaks.com/topic/96743-php-echo-problems/#findComment-495079 Share on other sites More sharing options...
djcritch Posted March 18, 2008 Author Share Posted March 18, 2008 ok so: a.html contains the following form: <form action="a.php" method="get"> <input type="text" name="text" size="50"> <br /> <br /> <select size="1" name="num1"> <option>0</option> <option>1</option> <option>2</option> <option>3</option> </select> <select size="1" name="num2"> <option>0</option> <option>5</option> <option>10</option> </select> <br /> <br /> <input type="submit"> </form> a.php is a frame set calling b.php and c.php a as follows: <html> <frameset rows="62px,90%"> <frame src="b.php"> <frame src="c.php"> </frameset> </html> now what i want to do is echo the information from a.php into b.php and c.php so that it can be called so: b.php will call the following: <?php echo $_GET["text"]; ?> <?php echo $_GET["num1"]; ?> <?php echo $_GET["num2"]; ?> and c.php will also callte following: <?php echo $_GET["text"]; ?> <?php echo $_GET["num1"]; ?> <?php echo $_GET["num2"]; ?> hope this makes it clearer Dave. Link to comment https://forums.phpfreaks.com/topic/96743-php-echo-problems/#findComment-495085 Share on other sites More sharing options...
djcritch Posted March 18, 2008 Author Share Posted March 18, 2008 hmmmmm im not to sure how to used php sessions where would i include it? Link to comment https://forums.phpfreaks.com/topic/96743-php-echo-problems/#findComment-495096 Share on other sites More sharing options...
frijole Posted March 18, 2008 Share Posted March 18, 2008 I guess you don't need sessions then as stated above ^. It seems like that set up should work. Is there an error of some kind? Or, if you need to. You would just add the code following to a.php: session_start(); $_SESSION['variableName'] = $_GET['variableName']; $_SESSION['variableName1'] = $_GET['variableName1']; $_SESSION['variableName2'] = $_GET['variableName2']; $_SESSION['variableName3'] = $_GET['variableName3']; and then whenever you want to echo the information in b.php, and c.php you would do the following: <?php echo $_SESSION['variableName']; ?> Link to comment https://forums.phpfreaks.com/topic/96743-php-echo-problems/#findComment-495109 Share on other sites More sharing options...
papaface Posted March 18, 2008 Share Posted March 18, 2008 or: session_start(); foreach ($_GET as $key => $value) { $_SESSION[$key] = $value; } Link to comment https://forums.phpfreaks.com/topic/96743-php-echo-problems/#findComment-495115 Share on other sites More sharing options...
frijole Posted March 18, 2008 Share Posted March 18, 2008 that is much more attractive. Link to comment https://forums.phpfreaks.com/topic/96743-php-echo-problems/#findComment-495119 Share on other sites More sharing options...
djcritch Posted March 20, 2008 Author Share Posted March 20, 2008 yes it is more attrctive but how do i echo it? something like this? <?php $_SESSION['url'] echo $_value; ?> ??????? Link to comment https://forums.phpfreaks.com/topic/96743-php-echo-problems/#findComment-496596 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.