Session Variable Woes..
Posted: Sun Apr 17, 2005 6:59 am
Hi All,
Could anyone here point me in the right direction?
User : d11wtq has helped me alot! I thank him very much.
Basically i'm trying to retrive a stockId from a drop down menu (which is retrieved from mysql) then pass that to the popup to view all associated data with that stockId.
The popup works but no data is passed. The URL looks like :
http://127.0.0.1/materials_register/tes ... d&stockId=
And the 'hello world' is being printed on the parent page not the shild page.
tia, will
Could anyone here point me in the right direction?
User : d11wtq has helped me alot! I thank him very much.
Basically i'm trying to retrive a stockId from a drop down menu (which is retrieved from mysql) then pass that to the popup to view all associated data with that stockId.
The popup works but no data is passed. The URL looks like :
http://127.0.0.1/materials_register/tes ... d&stockId=
And the 'hello world' is being printed on the parent page not the shild page.
tia, will
Code: Select all
<?php
include "includes/functions.inc";
include "includes/common_db.inc";
$link_id = db_connect($db);
global $PHP_SELF;
if ($_POST['submit']) {
echo '<pre>';
print_r($_POST);
echo "<h1>Submitted to DB</h1><br>";
echo '<a href="'. $_SERVER['PHP_SELF'] .'">Please try again</a>';
echo "</pre>";
} elseif ($_POST['viewDetails']) {
//Do whatever for second submit
echo $stockId;
echo $description;
view();
}
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<? $sql_query = mysql_query("SELECT description, stockId FROM austock");
echo "<select name=\"stockId\">";
while(list($stockname, $stockId)=mysql_fetch_array($sql_query)) {
$stockname = stripslashes($stockname);
echo "<option value=\"$stockId\">$stockname</option>";
}
echo "</select>";
mysql_free_result($sql_query);
?>
<br><br><input type="submit" name="submit" value="submit me!">
<br><br><input type="submit" name="viewDetails" value="View Details">
</form>
<?
function view() {
echo "<script language=\"javascript\">var newWindow = window.open('".$_SERVER['PHP_SELF']."?action=view_record&stockId=".$stockId."')</script>";
view_record($stockId) ;
}
function view_record() {
print "hello world <br>";
echo $stockId ;
print "<br>";
print_r($_SESSION);
}
?