Michael (and list) --
I've made the adjustment suggested the scripts are below.
What I'm trying todo is pass the "uid" and "mid" to the sales.php script.
It works the first time!! But if I reload sales.html the next record( w/ 
same uid) isn't added or if I login in as a different id the records aren't 
added?
Scripts: login.php and sales.php. 

Thanks for your time and knowledge,
David Jackson

-----  login.php -----------
<?php
// start session
session_start();
session_register("Uid");
session_register("Umid");
// Connect to db
include("/home/sites/www.pickledbeans.com/web/connect.php");

// insert new user
$result = mysql_query("SELECT id,mid,name,perms FROM staff
WHERE name = '$frm_name'"); 

if (mysql_num_rows($result)!=1) {
        echo "Dis ain't good !!\n";
echo "<html><body>";
echo "<meta http-equiv=\"refresh\" content=\"5; 
url=http://backoffice.pickledbeans.com/index.html\";>";
echo "</body></html>";
mysql_free_result ($result);
mysql_close($link);

} else {
   echo "We have winner:\n";

// parse out query output and resign to session vars
 list($id,$mid,$name) = mysql_fetch_row($result);
echo "<p>$id</p>";
echo "<p>$name</p>";
$Uid = $id;
$Umid = $mid;
$Uname = $name;


// redirect to main menu page
mysql_free_result ($result);
mysql_close($link);
echo "<html><body>";
echo "<meta http-equiv=\"refresh\" content=\"5; 
url=http://backoffice.pickledbeans.com/sales.html\";>";
echo "</body></html>";

}
?>

---------- sales.php ---------------
<?php
// If sesssion vars don't exist, goto login form
// else display sales data entry form
session_start();
// if(!session_is_registered("Uid")) {
//    echo "<p>We need to goto login screen!!</p>";
// } else { 
echo "<p>Session uid set to:$Uid</p>\n";
echo "<p>Session uid set to:$Umid</p>\n";
echo "<p>Session date: $frm_date</p>\n";
echo "<p>Session amount set to: $frm_amount</p>\n";
//
include("/home/sites/www.pickledbeans.com/web/connect.php");
// Insert Sales data into sales table
mysql_query("INSERT INTO sales(id,mid,date,amount)
                VALUES('$Uid','$Umid','$frm_date','$frm_amount')") ;
mysql_close($link);

echo "<html><body>";
echo "<meta http-equiv=\"refresh\" content=\"5; 
url=http://backoffice.pickledbeans.com/sales.html\";>";
echo "</body></html>";
?>

 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to