In a form,
I am displaying a select box value , based on that select box value i show two more select boxes using ajax in div id.
And I don not know about session, I want to save that in session using ajax . How to do?

Recommended Answers

All 5 Replies

You will have to be a bit more clear on your goal.

When you say session, are you talking about a PHP session? A cookie? The current "browser session"?

Perhaps detail your idea, and we can help give you direction on how to accomplish it. :)

I am telling about PHP Session

Trigger an ajax to post to a process.php with the code
process.php

if(isset($_POST['myVal']){
    session_start();
    $_SESSION['myRef'] = $_POST['myVal'];
}

Can you elaborate about myVal and myRef

ajax:

$.ajax({
    url:"process.php",
    type: 'POST',
    data: {"myVal":"The data I wish to be store into session"}
});

myVal will be the key of posting that contain the things you wish to store.
myRef will be the key of the session variable that you wish to access it later.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.