Jump to content
  • Advertisement
Sign in to follow this  
Brainx7

Jquery not working because of php session

This topic is 1572 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 http://jsfiddle.net/dnwTV/126/ is not working on my php page and I'm pretty sure is because of this part of the code:

 

<?php
session_start();

  function input_val($key, $remember = true) {
   $value='';
    if(isset($_REQUEST[$key])) {
       $value = $_REQUEST[$key];
       //Store value in session if remember = true
       if($remember) {
         $_SESSION[$key] = $value;
       }
 
       
    
       return $value;
    }else{
      //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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!