This is a code snippet for the page i am getting the variable $title from

$title = $this->row->title;

// at this point in the script if i echo $title the correct value is stored.

?>

<form name="passvalue" action="myscript.php" method="POST">
<input type="hidden" name="title" value="<?php echo $title;?>">
</form>

This is a code snippet from myscript.php

$title = $_POST["title"];
echo $title;

When the script is executed the value doesn't seem to get passed as the echo command prints nothing
so i assume that title is either not getting passed or retrieved

any help would be appreciated
thank you.

How are you submitting the form?

How are you submitting the form?

I am new to php so bear with me if this makes no sense, users click a reply link to go to another script page that calls the myscript.php when they click the link is the form data submitted?

when they click the link is the form data submitted?

No. At its simplest you would put a submit input field in the form. Then when the submit button is clicked, the form data is posted:

<form name="passvalue" action="myscript.php" method="POST">
    <input type="hidden" name="title" value="<?php echo $title ?>" />
    <input type="submit" name="submit" value="Click to Submit" />
</form>

No. At its simplest you would put a submit input field in the form. Then when the submit button is clicked, the form data is posted:

<form name="passvalue" action="myscript.php" method="POST">
    <input type="hidden" name="title" value="<?php echo $title ?>" />
    <input type="submit" name="submit" value="Click to Submit" />
</form>

Thanks for the help
I did some reading and discovered $_session which works like magic:)

so what I came up with is:

<?php
	session_start(); 
	  $_SESSION['title']= $this->row->title;  
      ?>

      <?php
	session_start();
	  echo $_SESSION['title'];
      ?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.