0
Hi, guys. I’m having a little problem with passing data from one page to another. I’ve tried by Session and not quite sure and I’ll explain why:
I have a news page that distributes them by a for in $arr[] where I fit the title, body of the news etc. Then, when entering a specific news (that read more), I have to give a SELECT in the database again and distribute the title, News body etc and this I do by her ID in the database. It happens that to pass the ID of the news that he clicked pro SELECT of the other page I got all confused. In my attempts something like:
first saving the data in the variable: $variable = array("$arr[2]")
2nd taking this given by the session: SELECT bla bla bla WHERE id = $variable and it does not return the value of this variable I did more or less above, of course I opened the sessions and everything more kkkkkk
Anyway, thanks in advance!
Friend can not determine the fault so, please read the link: http://answall.com/help/mcve
– Guilherme Nascimento
Place the code of the second page and the link or how you pass the variable from the first to the second.
– rray
When you use
$variavel = array("$arr[2]");
do you want to use$variavel = $_POST("$arr[2]");
? Notice that they are different things.– Sergio
If you want to save that to a session variable, you have to log in. If you want to send this to another page where you place the request you must have a variable Return. I use ajax to make requests to the server
– usersantos
Give me a return later if it worked out okay? Good luck there!
– Allan Andrade
@Allanandrade I did the following: I created a session and passed the value of the array. But, when trying to redeem this value on another page, it only shows the ID of value 1. What I didn’t understand is that when giving an echo on the page I passed the array, it shows the ID of the news perfectly in each repetition for. The problem is on the page where "resgato" this value. I was able to clearly explain this problem of mine?
– Léo Eduardo Silva
Put the code you made that I take a look.
– Allan Andrade