michael1291 Posted June 20, 2011 Share Posted June 20, 2011 Hi, i currently have a members area on a website which selects invoice info from the database if the invoice is for that member, however at the minute i have it so it only displays invoice id product etc and i want to allow the user to click more details and then it will retrieve the whole invoice. at the minute I' am using a select statement to retrieve the details however i need to get the the reference from the results and store it in a variable so that i can send it to another page through url. sorry if i have been confusing thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/239873-storing-variable-in-url/ Share on other sites More sharing options...
TeNDoLLA Posted June 20, 2011 Share Posted June 20, 2011 A bit confusing yes. You can transfer data between page loads using php-sessions. http://php.net/manual/en/features.sessions.php . Quote Link to comment https://forums.phpfreaks.com/topic/239873-storing-variable-in-url/#findComment-1232137 Share on other sites More sharing options...
michael1291 Posted June 20, 2011 Author Share Posted June 20, 2011 yeah sorry for been confusing, what i am trying to do is when the select statement retrieves the data i want to keep a reference number so i can use it else where, but this reference is not stored in the members stable but the invoices table so i cannot put it in a session can i? I am quite stuck lol Quote Link to comment https://forums.phpfreaks.com/topic/239873-storing-variable-in-url/#findComment-1232143 Share on other sites More sharing options...
Adam Posted June 20, 2011 Share Posted June 20, 2011 This isn't really what I'd qualify as session data. You just need to, as you said yourself, pass the invoice ID through the URL. Obviously you need to perform the necessary security checks, but it should just be as simple as that. What are you struggling with exactly? Quote Link to comment https://forums.phpfreaks.com/topic/239873-storing-variable-in-url/#findComment-1232148 Share on other sites More sharing options...
michael1291 Posted June 20, 2011 Author Share Posted June 20, 2011 i dont know how to get the invoice id in to a variable to send through the url it works great when i set the url to a certain invoice id but i need it to bring back the information depending on the invoice id selected. Quote Link to comment https://forums.phpfreaks.com/topic/239873-storing-variable-in-url/#findComment-1232152 Share on other sites More sharing options...
michael1291 Posted June 20, 2011 Author Share Posted June 20, 2011 This is what i have $id = "lsp03"; echo "<a href=\"view-invoice-details.php?id=" .$id. " \">View invoice Details</a>"; if the $id variable is set to a specific id and then i on the details page i say $_GET the id from the url it works and brings back the invoice based on the id lsp03. however i don't know how to change it so it bring back the data if any id is selected. Quote Link to comment https://forums.phpfreaks.com/topic/239873-storing-variable-in-url/#findComment-1232154 Share on other sites More sharing options...
TeNDoLLA Posted June 20, 2011 Share Posted June 20, 2011 When you create the links to the details you should print the corresponding invoice id's into the links from the database results. Quote Link to comment https://forums.phpfreaks.com/topic/239873-storing-variable-in-url/#findComment-1232156 Share on other sites More sharing options...
michael1291 Posted June 20, 2011 Author Share Posted June 20, 2011 [RESOLVED] I just inserted the invoice reference id that has already been retrieved in to the variable which is used in the url and it now brings back and displays the invoice basedo n the invoice selected. $id = $row['invoice_reference']; thanks for the help appreciate it Quote Link to comment https://forums.phpfreaks.com/topic/239873-storing-variable-in-url/#findComment-1232158 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.