0

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.

Edited by deceptikon: Added code tags

2
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by paulhook
0

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?

0

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>

Edited by deceptikon: n/a

0

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'];
      ?>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.