Advertisement Jump to content
Sign in to follow this  

Jquery not working because of php session

This topic is 1659 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

so this code is not working on my php page and I'm pretty sure is because of this part of the code:



  function input_val($key, $remember = true) {
    if(isset($_REQUEST[$key])) {
       $value = $_REQUEST[$key];
       //Store value in session if remember = true
       if($remember) {
         $_SESSION[$key] = $value;
       return $value;
      //Return session data
      return isset($_SESSION[$key]) ? $_SESSION[$key] : $value;



I have no idea why. What the function inside the php does, is allow me to use a "" value on an inputbox so that when the user enters something the input is remembered on submit. for example <input type="text" name="Alias" class="required" size = "20" placeholder="name"  value="<?php echo input_val('Alias'); ?>"  > inside a form that uses method get. Then in the php where the input is posted I have the same function, and where the input goes I just have <?php echo input_val('Alias'); ?> and then if I go back one page to edit something the input is remembered

Edited by Brainx7

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!