Jump to content

Need some help with a form and a link


Fenhopi

Recommended Posts

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!

             

Link to comment
https://forums.phpfreaks.com/topic/221762-need-some-help-with-a-form-and-a-link/
Share on other sites

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?

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
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.