Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Last Attempt - Session

Status
Not open for further replies.

ZOR

Technical User
Jan 30, 2002
2,963
GB
This is my last try on this site for what seems would be so simple to one that knows the answer.

<?php
session_start();
$_SESSION['XXX'] = $_POST['XXX'];

print '<html><body>
<a href="Menu1.php">click here</a>
</body></html>';
?>

How can I complete the task in the code above WITHOUT A BUTTON TO PRESS TO GO TO A MENU. How do I replace the line <a href="Menu1.php">click here</a> to make it just go to
Menu1.php page.

Thank you.
 
how about this:
Code:
session_start();
$_SESSION['xxx'] = $_POST['xxx'];
header("Location: somepage.php");



----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
I think there must be a problem with the server, or browser settings or something.

The code below redirects okay to the menu page, however
when I click a button on the menu page to open the stored values they are empty.

session_start();
$_SESSION['xxx'] = $_POST['xxx'];
header("Location: somepage.php");

It still remains the code below works, however I have an unwanted button to press before going back to the menu.

<?php
session_start();
$_SESSION['XXX'] = $_POST['XXX'];
print '<html><body>
<a href="Menu1.php">click here</a>
</body></html>';
?>

I think I will have to start getting to speed with MySQL and possibly dump values in. I will also look at Meta Tags.

Switching off now as had too many hours going round with it. Thanks again both of you. Regards

 
I've had this problem too. You might want to try the meta refresh tag set to 0.

<meta http-equiv="refresh" content="0;URL=http://www.yourdomain.com/your/url/">

---------------------------------------
 
Ok, you're saying that this does not work?
Code:
foo.php
<?php
session_start();
$_SESSION['foo'] = 'Hello World!';
header("Location: bar.php");
?>

bar.php
<?php
session_start();
echo $_SESSION['foo'];
?>
Running this on your server does not print out Hello World! on the second page?
 
I ran it before i posted it, and it does in fact run.

Does this work for you?

Page1.php
Code:
<?php
session_start();
$_SESSION['hello'] = "Goodbye";
header("Location: page2.php");

?>

Page2.php
Code:
...
<body>
<a href="page3.php">Click here</a>
</body>
...

Page3.php
Code:
...
<body>
<?
echo $_SESSION['hello'];
?>
</body>
...


This Works. on page 3 you get and echo saying Goodbye.
What is it not doing for you??

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Are you talking about the first submit button that passes the $_POST{xxx] variable to the next page to get put in as a session variable?

Or an other button???


----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top