Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

session_start();

Guest
Feb 26, 2012 Feb 26, 2012

I want to send information from one page to another using the session_start();.

Lets say that page1.php has a session above the <!DOCTYPE HTML> doctype.

<?php

  session_start();

  $_SESSION['mylink'] = $row_mymeeting['congremtid'];

?>

And in my body tag the following shows...

<body>

<a href="page2.php">Here we go</a>

</body>

When I look at page1.php in my browser I get an error

Notice:  Undefined variable: row_mymeeting in /Applications/MAMP/htdocs/phptest/www/index.php on line 5

However if I put $_SESSION['mylink'] = "Hello, Welcome to Adobe!"; when I click on the link to the page2.php page it shows.

And on  page2.php I want it to echo what ever the $row_mymeeting['congremtid'] has in my databse.

One page 2 I have...

<?php

  session_start();

?>

<?php

echo $_SESSION['mylink'];

?>

But I get a blank.

How can I make my $_SESSION['mylink'] = $row_mymeeting['congremtid']; echo in my second page, what am I missing?

Thank you.

Regards,

AdonaiEchad

TOPICS
Server side applications
567
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Feb 27, 2012 Feb 27, 2012

Have you got a recordset on the page which SELECTS 'congremtid' from the database? AND is the line $_SESSION['mylink'] = $row_mymeeting['congremtid']; AFTER the sql query? If you haven't or the line is NOT AFTER the sql query you will get an error about the Undefine Variable.

Translate
LEGEND ,
Feb 27, 2012 Feb 27, 2012

Have you got a recordset on the page which SELECTS 'congremtid' from the database? AND is the line $_SESSION['mylink'] = $row_mymeeting['congremtid']; AFTER the sql query? If you haven't or the line is NOT AFTER the sql query you will get an error about the Undefine Variable.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 27, 2012 Feb 27, 2012
LATEST

Thank you osgood.

That was my issue.

The $_SESSION['mylink'] = $row_mymeeting['congremtid']; was placed before the recordset.  I placed it at the top of the recordset therefore I was getting the error that I posted in this forum.

Again, thank you.

It is amazing that positioning can do a lot.

Regards,

AdonaiEchad

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines