/    Sign up×
Community /Pin to ProfileBookmark

Passing var by url…

Hi!

I’m working on a web application and i what to know what’s the best way to pass var from page to page.

I use to pass var bu url but it’s not very secure for this application, and i don’t want to use hidden field.

Can we pass var invisible from the url?

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@JickMar 11.2004 — If I understand you correctly you can do this with sessions in php. I'm not very good with them so you might ask for help with sessions. ?
Copy linkTweet thisAlerts:
@turbauthorMar 11.2004 — Ok here's the situation...

I've got a page with a list of task. Each task have a link page.php?id=some number.

So when a user click on a link, then i can set a session variable but for this, i've got to put the variable in the url, cause i don't what to use hidden field.

i know i can put a page between, set the var session and then redirect to the good page but i want to know if there's another alternative!!

t
Copy linkTweet thisAlerts:
@JonaMar 11.2004 — [font=arial]Sessions would be the only way, other than cookies (but not everyone has cookies enabled, so that isn't a good choice). What you can do is have the page.php?id=some number page read from $_SESSION[] instead of $_GET[]. Use [url=http://php.net/session_start]session_start()[/url] to begin the session at the very beginning of your code (before anything else), then set the value of it (say $_SESSION["id"] = some number), and when the user goes to the next page, use session_start() again at the beginning, and read from $_SESSION["id"].[/font]

[b][J]ona[/b]
×

Success!

Help @turb spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.27,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...