Hey,
I have some php code that I cant seem to get working...
Here is the code...
This is the javascript that changed the ?show in the url to what the user selects..
<script type="text/javascript">
function show(){
var e = document.getElementById("select");
var strUser = e.options[e.selectedIndex].value;
window.location = "?show="+strUser;
}
</script>
<select name="select" id="select" onchange="show();">
<option value="<?php if(isset($_SESSION['show'])){ echo $_SESSION['show']; }else{ echo "16"; } ?>" selected="selected"><?php if(isset($_SESSION['show'])){ echo $_SESSION['show']; }else{ echo "16"; } ?></option>
<option value="16">16</option>
<option value="32">32</option>
<option value="48">48</option>
<option value="64">64</option>
</select>
PHP Code the works it out...
If both the session and the get are blank it needs to be 16 but if the session is blank but the get isnt set the session to the get value else if the get is blank but the session isnt get the session to the session...
(hope this makes sense)
if($_GET['show'] == NULL && $_SESSION['show'] == NULL){
$_SESSION['show'] = "16";
}
elseif($_SESSION['show'] == NULL){
$_SESSION['show'] = $_GET['show'];
}
else{
$_SESSION['show'] = $_SESSION['show'];
}
$max_results = $_SESSION['show'];
But it doesnt seem to be working on the PHP side...
Dan