beachdaze Posted May 14, 2009 Share Posted May 14, 2009 Afternoon, I have a form that when submitted runs a validation script then goes to "Case B" and using the window.location.href script to the printable page. Since I lose variables going thru the redirect script I need some kind of unique value to key on to pull the data from the db that was submitted from the form. I was thinking that a simple counter could be added that would write to the db, incrementing the value by 1, and I can then do a select query to fill out the printable (as in paper printing) certificate. Any tutorials/guides/code would be helpful. Thanks! Quote Link to comment Share on other sites More sharing options...
Brian W Posted May 14, 2009 Share Posted May 14, 2009 why don't you just save a unique identifier as a session and also save it in the db? Quote Link to comment Share on other sites More sharing options...
beachdaze Posted May 14, 2009 Author Share Posted May 14, 2009 Like I said, not sure a counter is what I need. If I set a session this will give me a unique ID to key on? How do I increment it? Quote Link to comment Share on other sites More sharing options...
Brian W Posted May 14, 2009 Share Posted May 14, 2009 Something like: if(!isset($_SESSION['unique'])){ $unique=rand(10000,99999); $_SESSION['unique'] = $unique; } else { $unique = $_SESSION['unique']++;//increment by one } But I think I'm really lost as to what you plan on doing here. If you need to keep track of data someone filled out, you don't want to increment because then how are you supposed to pull their info again? Quote Link to comment Share on other sites More sharing options...
beachdaze Posted May 14, 2009 Author Share Posted May 14, 2009 Thanks for the help. What I'm trying to do is once the form has been filled out and submitted to the db, some of that data (First/Last Name) and this unique number I need will be sent to a table on a page to be printed. All the db data will be eventually exported and added to our main db that is not directly connected. I had planned on using the autoID number from the MySql db, but due to the vars getting stripped out from the javascript redirect, I can't get any records to match using $_POST['var']. That's what got me thinking about using a counter to create a unique number and stroing it in a var I can pass thru the javascript. Hope this is isn't too unlcear! Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 14, 2009 Share Posted May 14, 2009 I would keep track of the ID PK number for the row that the data was inserted. Then just use SELECT. I don't know how your DB table structures so I can't say that would be the best way. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.