Question : ajax save to session without an alert box

dont want an alert box

if this is not possible
please do a box where user doesnt have to click 'ok'
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
<?php
    session_start();
    if(isset($_GET["sessionVar"])) {
        $svar = $_GET["sessionVar"];
        $_SESSION["sessionVar"] = $svar;
        echo "sessionVar with value $svar is saved to session variables !";
    }
    else {
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script language="javascript">
    function saveChoiceToSession(o) {
        var sessionVar = o.options[o.selectedIndex].value;
        if(sessionVar!=null) {
            var xmlhttp = null;
            if(window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); } else{ xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }
            if(xmlhttp != null) {
                xmlhttp.open("GET","saveToSession.php?sessionVar="+sessionVar,false);
                xmlhttp.send();
                alert(xmlhttp.responseText);
                return;
            }
            alert("bad news : ajax call failed !");
            return;
        }
    }
</script>
</head>
<body>
<select onchange="saveChoiceToSession(this)">
    <option value="">Choose one...</option>
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
</select>
</body>
</html>
<?
    }
?>

Answer : ajax save to session without an alert box

SQL Scheduler at lazycoding.com is a free scheduler that works great with SQL Express; i've been running it extensively for well over a year without a glitch
Random Solutions  
 
programming4us programming4us