# Jquery not working because of php session

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

## 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 on other sites

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:

What do you think this code is doing?