Forum Moderators: coopster
it first gets the variables pid and version either from a POST or GET.
these variables should be sent to the next page using the hidden
input fields - the problem is that there is nothing coming out at the other end (test_postget.php)
thanks for suggestions
m
<? require "includes/initialize.inc.php";
// get pid and version info
$pid=$_POST['pid'];
if (!isset($pid)) $pid=$_GET['pid'];
$version=$_POST['version'];
if (!isset($version)) $version=$_GET['version'];
// /////////////////////////////////////////////
if (isset($_POST['confidence'])) {
$sql = "replace into ProFra_Conf set timestart=now(), version=".$version.", position='1',pid=".$pid;
$db->query($sql);
$sql = "update ProFra_Conf set pid=pid";
foreach ($_POST as $key => $value) {
$sql .= ", $key=\"$value\"";
}
$sql .= " where pid=".$pid;
$db->query($sql) or die("error in $sql : ".$db->error);
header("Location: http://example.com/test/test_postget.php");exit;
}
include $CFG["doc_root"]."/includes/header.inc.php";?>
<b>Confidence</b><br/><br/>
Please answer the following items by clicking on the black bars to indicate how much each statement applies to you.
<br/><br/>
<form name='mainform' method=post onSubmit='return checkform(this,1);'>
<input type=hidden name="pid" value="<?echo($pid)?>">
<input type=hidden name="version" value="<?echo($version)?>">
1. How confident are you about the decision you just made?<br/><br/>
<? continuous_scale("confidence","very confident","not at all confident");?><br/><br/>
<br/>
<table width=100%><tr><td align=right width=100%>
<input type=submit value='Continue' />
</td></tr></table>
</form>
<? include $CFG["doc_root"]."/includes/footer.inc.php";?>
[edited by: dreamcatcher at 10:57 am (utc) on Feb. 27, 2007]
[edit reason] Generalised url. [/edit]
a short follow up:
what i do is assigning $pid and $version to session on the page i posted - and getting it from the _SESSION back on the test_getpost.php page ...
right?
which brings also the question into the game how to assign a variable to as session ...
thanks again
mschultem
session_start();
Must be at the top of all your pages where you are accessing vars from the session. Then use:
$_SESSION['pid'] = $pid;
$_SESSION['version'] = $version;
On your 'test_getpost.php' page use:
echo $_SESSION['pid'];
echo $_SESSION['version'];
Some people tend to forget to start the session. Also, set your error reporting level to E_ALL for development. That can sometimes filter out any problems.
dc