Gnub Posted March 14, 2007 Share Posted March 14, 2007 Situation: I have a query that is returning results. the results are then posted on the page. Each result is different from each other. Next to each result, i want to place a button, that when clicked, will carry some of the fields from that specific result to another form,(on a different page/script) where some actions will be performed. Im thinking the best way to do this is to use sessions. Question: How would i go about issuing a session variable to each result, and when that button is clicked, carry that 1 specific session over to the form, where i can carry on happy as Larry. Could i do example: While (there is data) { Post results variable = field(s) session['variable'] Link to new page } Thanks for any feedback. Quote Link to comment Share on other sites More sharing options...
aebstract Posted March 14, 2007 Share Posted March 14, 2007 I'm not 100% sure of what you want, but would something like this do the trick? if (isset(data)) { form field with data } else { form field without data } Just set the value to a variable and if its set you have the form field with data have that variable as its value? Quote Link to comment Share on other sites More sharing options...
Gnub Posted March 14, 2007 Author Share Posted March 14, 2007 Sorry, i'll try and explain it better. On page1.php i have a query that displays the results in a list. What i want to do, is take some of the fields from a result, and carry it over to another page, through the use of a button next to each result. Pretty diagram: *** Result1: Name: Jo, Surname: Jones, DoB: 12/12/1960, House No: 12 [button] Result2: Name: Bob, Surname: Baluga, DoB: 12/11/1961, House No: 15 [button] *** Let's say i press the [button] (Represents a link on the page) and on this new page, i have a form. I want to take certain fields from that result(lets say Name, and DoB), and place it inside one of the form elements(TextArea). Hope that helps. Quote Link to comment Share on other sites More sharing options...
aebstract Posted March 14, 2007 Share Posted March 14, 2007 So you need to either pass them through using sessions or through the url. To go through the url just set each value like: index.php?name=$name&dob=$dob then you can grab them from the url on the next page with $name = $_GET['name']; and etc. I'm a little rusty on sessions as I haven't done them in like two years so this is as far as I can give help, I think. Hope it helps though! Quote Link to comment Share on other sites More sharing options...
Gnub Posted March 14, 2007 Author Share Posted March 14, 2007 Infact, that does. just noticed the help you gave about URL's on the other post, which set my mind in motion. Thanks! 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.