Passing POST variable into two pages back and forth [closed] - php

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have a scenario here in which I am confused to solve. So here is the matter,
I have a PHP page with the project selector that gives the value into monitorIndex.php
And in the monitorIndex.php im using that given value with this
if(isset( $_POST['cd-dropdown'])) $_SESSION['cd-dropdown'] = $_POST['cd-dropdown'];
in which I use $_POST['cd-dropdown'] as the value used everywhere
now my question is, when user click on the navigation menu to go to a page called monitorTable.php, how do I still use the $_POST['cd-dropdown'] ? and how to make variable alive when user navigate out from that page and go back to monitorIndex.php and keeping the $_POST['cd-dropdown'] alive
thank you so much

You can use the
$_SESSION['cd-dropdown']
since it was assigned.
it will only destroy if session_destroy is invoke.

Related

How many ways we can pass the variable through the navigation between the pages? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Which is Better And Secure way to Pass the variable through the navigation between the pages?
Three ways can pass the variable through the navigation between the pages:
Put the variable into session in the first page, and get it back from session in the next page.
Put the variable into cookie in the first page, and get it back from the cookie in the next page.
Put the variable into a hidden form field, and get it back from the form in the next page.

Run script when session starts? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
How do I run a script (ie, $viewcount += 1;) when a session starts in PHP? I'm trying to make a view counter script for my website which currently works, assuming I include('view_counter.php') in every page to add something to my text file of views. Unfortunately, people can reload the page and so add up the view count really quickly. What I'd like to do is add to the view count every time somebody opens a new session on the site. It should be obvious, but how do I do it?
Just check if the Session object exists or not yet using an IF statement, and if it doesn't, it means it's a new session in which you can run your counter code.
More info on working with sessions: Check whether a session is new in PHP

How to set a parameter in php, and how to get its value? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
How can I see the Edit Mode page is the link is written like:
<small><i>Edit Mode</i></small>
In the above case, if I click the Edit Mode button in the homepage, does it mean editz will be assigned a value as 1?
Another question is if I have three php files a.php, b.php and c.php, which all check isset($editz), how can I redirect the page to a.php, rather than file b or c if I click the Edit Mode button?
Sorry maybe my question is too simple a naive, but I am a newbie to php, it is my first time tough php code. Please be kind to share some light:)
Just to give some sort of answer to this, spanning from the comments:
Anything following a ? in a URL is a query string, and the parameters (each separated by &) can be accessed with the $_GET['parameter_name'] function. In this case, $_GET['editz'] was needed.

PHP - MVC Render View [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
Im using a custom MVC built by me..
Im fairly new to this approach, and im having some trouble to understand all of this.
My website has a login system that allows the users to log in in any page(view).
What i want to do is:
After the user logs in, the controller will render the view he was on before the call to the controller login function.
So header is out of the options since i need to send a view to be rendered
Does anyone has a solution to do this?
Why don't you track the where the user came from in a session variable?
Session is always available.
Sessions are not accessable to anyone outside you're system.

Provide embedded block for another site [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I need to provide some functionality to another site.
What way is better and why?
1. Iframe
2. Provide PHP code and HTML/CSS.
I trust another site's admin.
First option is good but you keep all the responsabilities on your side. if an error occur, you're the only one to blame.
HOW? : you generate a regular Html page and give them an iframe. that's how facebook does it.
Option 2 is the eazy way but you talk about storing things into your DB. in this case i hope you know the guy who manage the other website.

Categories