Jump to content

Help with hyperlinking


simbarashe

Recommended Posts

Hie

 

Could someone pliz help me, I'm trying to click a hyperlink and get the session variables that i have created to show on the following page. I've pasted my code below and coz some1 please have a look and help where he/she thinks I'm getting it wrong

 

<?php

session_start();

require_once('dbFunction.php');

?>

 

<td>

<a href="index.php?page=jobSheetDisplay.php">

      <?php      

            $min = 15;

            $displayEnteredInfo = displayEnteredInfo($t,$min);

$_SESSION['jobDIdisp'] =$displayEnteredInfo;

echo $_SESSION['jobDIdisp']; 

        ?>

  </a>

</td>

 

The code is quite a lot so i trimmed it out, The above works perfectly as you can see I have assigned $displayEnteredInfo to a variable becoz i want to use it on the next page I'll go to when I click the hyperlink.Below is the code for the following page.

<?php

session_start();

require_once('dbFunction.php');

?>

 

<td>Job Number<td class="formText">

<?= $_SESSION['jobDIdisp'];>

  </td>

 

It seems as if $_SESSION['jobDIdisp']; is losing its value when I click the hyperlink. Is the a better way I could hyperlink?

 

Thank you

 

Link to comment
https://forums.phpfreaks.com/topic/42294-help-with-hyperlinking/
Share on other sites

if you only intend to use the value for the next page..you could do this instead..

 

<? $info =$displayEnteredInfo;

?>

<a href="nextpage.php?info=<?=$info?>">

 

This scenario requires you to you pass first the $displayEnteredInfo value to $info before you use the <a href> tag..

 

hope i helped you.

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.