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
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?

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.