Jump to content

Not sure a counter is what I need


beachdaze

Recommended Posts

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!

Link to comment
https://forums.phpfreaks.com/topic/158163-not-sure-a-counter-is-what-i-need/
Share on other sites

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?

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!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.