Fenhopi Posted December 15, 2010 Share Posted December 15, 2010 Hi, I have a script that creates a frame. The script shows a page of my choosing. However, somehow I need to transfer some values like username from one page, to the page that is opened in the frame. To call the frame I use like this: <a href="postback.php" id="start">TEST </a> But the only way I know to transfer values between pages is with forms and $_POST. So I have this form: <form method="post" action="postback.php"> <input type="hidden" name="postbackto" value="<? echo $friendshares['byuser']; ?>"> <input type="hidden" name="postbackfrom" value="<? echo $friendshares['person']; ?>"> <INPUT NAME="post" TYPE="submit" class="submit" id="start" value="That's nice" ALT="like"> </form> So what I'm trying to do is that when I click the link, the form is submitted, the frame opens the postback.php and I can view the info from the form. All help is appreciated! Quote Link to comment Share on other sites More sharing options...
solon Posted December 15, 2010 Share Posted December 15, 2010 try this <a href = 'postback.php?postbackto=<?php echo $friendshares['byuser']; ?>&postbackfrom=<?php echo $friendshares['person']; ?>'>TEST</a> and then instead of using $_POST['postbackto'] etc use $_GET['postbackto] Quote Link to comment Share on other sites More sharing options...
Fenhopi Posted December 15, 2010 Author Share Posted December 15, 2010 Thanks, man. It did what I tried doing but it didn't work out. Because the frame opens over the window I'm in, so what happens is that i click the link, it starts opening the frame, then I get redirected to postback, and I want to stay on the page I am and just retrieve it through the frame. Any idea how to do this? Quote Link to comment Share on other sites More sharing options...
litebearer Posted December 15, 2010 Share Posted December 15, 2010 I like Solon's idea. As an added option, might consider a div rather than a frame and sessions to pass the variables Some psuedo code to ponder... $_SESSION['byuser'] =$friendshares['byuser']; $_SESSION['person'] = $friendshares['person']; ?> <a href="postback.php">some text</a> <?PHP if(!isset($_SESSION['byuser']) OR !isset($_SESSION['person'])) { echo an empty div }else{ echo a div with the content you want } Quote Link to comment Share on other sites More sharing options...
solon Posted December 15, 2010 Share Posted December 15, 2010 Actually i believe that litebearer's idea is the one to go with based on what you said in your last post. since it opens in a frame by setting the variable into a session variable it should work Quote Link to comment 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.