Forum Moderators: coopster
Need to collect a set of variables on a given page such as "pricing" and "item name", then pass these to a form without any user input. So after these hidden variables are extracted I need to submit them to another page with a form, where they could be sent after standard contact fields were filled in.
The collected data will change from page to page, but the variables will always be the same (about 10 of them). But I was thinking that variable could be represented on the page using custom tags like <price> and <itemname> for example that would surround the content on the page in order to extract it.
echo("You came from {$_SESSION['var']}<br>");
}
$_SESSION['var'] = "page 1";
?>
<body>
Go to: <a href="page1.php">page 1</a>  
<a href="page2.php">page 2</a>  
<a href="page3.php">page 3</a>  
</body>
</html>
In page2.php put this
<html>
<?php
//we have to put this in every page
//if you don't your session variables won't work
session_start();
if($_SESSION['var']){
echo("You came from {$_SESSION['var']}<br>");
}
$_SESSION['var'] = "page 2";
?>
<body>
Go to: <a href="page1.php">page 1</a>  
<a href="page2.php">page 2</a>  
<a href="page3.php">page 3</a>  
</body>
</html>
in page3.php put this
<html>
<?php
//we have to put this in every page
//if you don't your session variables won't work
session_start();
if($_SESSION['var']){
echo("You came from {$_SESSION['var']}<br>");
}
$_SESSION['var'] = "page 3";
?>
<body>
Go to: <a href="page1.php">page 1</a>  
<a href="page2.php">page 2</a>  
<a href="page3.php">page 3</a>  
</body>
</html>
Now I just used simple static variables however, you could have as many $_SESSION['var']'s as you need i.e. $_SESSION['price'] $_SESSION['itemname'] and then set them to form input. Let me know if you need more help.