Jquery not working because of php session

Started by
0 comments, last by DeafManNoEars 9 years, 9 months ago

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

Advertisement


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?

This topic is closed to new replies.

Advertisement