Not sure if anyone understood my problem but if you did and are having something similar I will post how I figured it out.
I simply had to add a session_start(); on my form..
<?php
session_start(); //see here
//this is the form that will change the variable
if(isset($_POST['submit']))
{
$the_user_garden = $_POST['sub_garden_1'];
}
?>
<form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
<input type="text" name="sub_garden_1" value="sub_garden_1"><br>
<input type="submit" name="submit" value="Submit Form"><br>
</form>
Related Posts:
- How to add elements to an empty array in PHP?
- Where to get information about array fields in $_REQUEST?
- Pass a PHP variable to another file
- Variables declared in header not available in other includes
- How do I make my function add variables/values to the $post object?
- Display message once per session to users with a specific role
- How to log out everywhere else, destroy all sessions “all other devices”?
- Why does $_SESSION only work when I am logged in?
- Cleanest/Fastest way to avoid calling and retrieving data from the database multiple times?
- how to create and show sessions in word press?
- where to include a php file
- How do I know what variables are passed in a filter/action and what their meaning is?
- Should I store my Facebook access tokens?
- Site Health : An active PHP session was detected
- integrating external php library into wordpress- the right way
- When would you use $_post instead of $post?
- How to expire session after 2 hours and also expire when browser closed?
- Locating Global Variables
- Pass PHP variable to JavaScript without inline JS
- Count the number of times the search form template gets included on a page
- Putting PHP variables into javascript [duplicate]
- Variable global scope [closed]
- How to rewrite URL with PHP variables with htaccess to a normal looking URL?
- Using a variable in is_page(array())
- Static variable and add_rewrite_rule?
- How to put a variable in a instance in the widget
- Call global variable array() in woocommerce child/template
- get_term_link() returns correct – But illogical error-messages disturb
- Fatal Error relating to sessions.php
- How can I Add a variable PHP in the Menu Nav
- Pass variable from one function to another
- Get value from shortcode to do something
- How to store post ID’s in cookie or session to display the same posts later
- PHP, Creating a dynamic variable
- How to modify a global variable in a function and use it on another function?
- Unique session WordPress
- Get my site session in wordpress?
- Variable not staying set
- Having Issue on Redirecting With Session in WordPress
- How to pass a PHP $_GET variable and fetch/output it?
- Creating WordPress Shortcode with Variable
- How to put a form with php code into a variable or shortcode?
- Apply class to every third list item? [duplicate]
- persist a variable set in header.php all the way down to footer.php
- How to deal with too many $_POST variable conditions from ajax request at backend? [closed]
- What is the alternative code to if (isset ($_POST) && !empty ($_POST) to avoid warnings?
- How to pass a variable to get_template_part that’s updated every time the template part is called?
- $_SESSION variable not saving on page refresh or new page
- Insert page content into another page with a changed variable
- Pass Variables or Variable Place-Holder from Editor to PHP
- $_SESSION variables work perfectly on my local machine but returns NULL on development webserver
- How to access or parse key/values that have “string”
- How Do I Find & Remove H1 From Site-Title-Wrapper? [closed]
- Changing the order of custom fields in the dashboard for Woocommerce variable products [closed]
- javascript variable to wordpress php variable
- The session works on the local server, but not on the web server
- How to reference PHP in Javascript
- Can we stop session reset if page reloads?
- Overide Variable in Child Theme
- echo var into wp_query
- how can I include some custom variable from functions.php?
- Dynamically adding filters
- WordPress is removing query variables like page, p from the URL of a custom static page
- Deleting expired session tokens in WordPress
- PHP: $_SESSION destroyed after page reload for my custom session
- How to send a php var to jQuery Ajax call with two different file
- Are there any drawbacks on opening a session_start in functions.php and header.php?
- How to check a variable Changes
- global $product is empty string when passed into function
- Can’t pass var from php wp_ajax into ajax script : result undefined or null
- Like and Dislike Buttons on Post with Counter – Only allow one click per post per user session
- Custom global variable not working in function
- WordPress How do I pass a variable from one add_action to another?
- PHP session not staying alive. headers already sent
- Best way to use variables in multiple functions?
- Trying to add some custom text into WordPress Post title via function.php
- Reduce Stock Based on Custom Variation Field Rather than Attribute (Working Script)
- How do I fix Undefined variable using $_POST in function?
- Sessions with WordPress
- How to find php variable of wordpress theme settings
- Use WP user status (logged_in) to manage access to independent application
- PHP Session Variable to WordPress Error
- Allow user to select location and then set cookie for location in WordPress
- Undefined variable & issue with smof_data
- Where can I find the declaration of `$_wp_theme_features`?
- Child theme functions.php file change database entries
- Custom Taxonomy Link Text Echo Name Not Slug
- how to add number value in front for variable [closed]
- How to ‘remember’ a site member’s last visited page?
- White screen after login attempt
- Difference in Get Variable Location
- WordPress & PHP sessions
- If I define a variable in header.php, how do I make it available to templates?
- Shortcode not passing variable to included file
- Import and use a variable in additional settings of Contact Form 7 [closed]
- Use ajax response in PHP function
- WP query with variables gives no result for specific user
- How to transfer session after being redirected to other page
- Suddenly sessions and header location not working
- PHP – Having $_SESSION as an array and adding $_SESSION to array