| | |
Seeting up and calling variables stored in sessions
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jan 2005
Posts: 20
Reputation:
Solved Threads: 0
hi,
i was wondering if anyone could help me. i'm new to php and i'm having problems setting up a session.
i have a login page (page1) where the user inputs their username and password and when they click the submit button they are brought to another page (page2) where they have two options. if they choose option to purchase a ticket they are brought to page3 where they choose the type of ticket. when they click submit on page3 it executes a php script that generates a ticket number and inserts it into the ticket table.
what i want to do is also insert the users AccID against the newly generated ticket number.
i want to get the AccID from the Users table when the person logs in at page1 and insert it when the person clicks submit oon page3.
i have tried some code but i am unsure where the session code goes and how to call variable stored in it.
can anyone help?
thanks in advanced,
scoobie
i was wondering if anyone could help me. i'm new to php and i'm having problems setting up a session.
i have a login page (page1) where the user inputs their username and password and when they click the submit button they are brought to another page (page2) where they have two options. if they choose option to purchase a ticket they are brought to page3 where they choose the type of ticket. when they click submit on page3 it executes a php script that generates a ticket number and inserts it into the ticket table.
what i want to do is also insert the users AccID against the newly generated ticket number.
i want to get the AccID from the Users table when the person logs in at page1 and insert it when the person clicks submit oon page3.
i have tried some code but i am unsure where the session code goes and how to call variable stored in it.
can anyone help?
thanks in advanced,
scoobie
I would suggest using <input type="hidden" name="AccID" value="$AccID"> in your forms so that the data is continuously passed from one form to the next.
•
•
Join Date: Jan 2005
Posts: 20
Reputation:
Solved Threads: 0
hi
thanks for that it worked.
would you have any idea how to do the same with a new user whose id is only generated when they register. i would like to use the same insert query though.
here is the qry that i have
$insert = "insert into tickettbl (AccID, ChrgID, TicketNo, TimeData, RecDate)
values ('$AccID', '$row->ChrgID', '$Random', '$OptionFrm', '$TodaysDate')";
it can be done if in the values section of query i change $AccID to LAST_INSERT_ID().
i need to somehow get the AccId from new record on store it in $AccID
thanks for that it worked.
would you have any idea how to do the same with a new user whose id is only generated when they register. i would like to use the same insert query though.
here is the qry that i have
$insert = "insert into tickettbl (AccID, ChrgID, TicketNo, TimeData, RecDate)
values ('$AccID', '$row->ChrgID', '$Random', '$OptionFrm', '$TodaysDate')";
it can be done if in the values section of query i change $AccID to LAST_INSERT_ID().
i need to somehow get the AccId from new record on store it in $AccID
![]() |
Similar Threads
- exception when calling an oracle stored procedure from java program (Java)
- Calling and executing stored Procedure (C)
- Email addrress in Sessions (PHP)
- Sessions ??? (PHP)
- Object-Oriented Programming (C++)
- Calling Oracle Stored Procedures with ASP (ASP)
Other Threads in the PHP Forum
- Previous Thread: Parsing variabls to texbox
- Next Thread: if statement in php
| Thread Tools | Search this Thread |
apache api array beginner binary body broken buttons cakephp checkbox class cms code cron curl database date date/time display dynamic ebooks echo email error file files folder form forms function functions global google href htaccess html image include insert ip javascript joomla limit link list login mail mediawiki menu mlm msqli_multi_query multiple mycodeisbad mysql number oop parameter paypal pdf php phpincludeissue problem query radio random recourse recursion regex remote script search seo server sessions sms source sp space speed sql static subdomain syntax system table tag tutorial update upload url validator variable vbulletin video web webdesign white wordpress xml youtube





