Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

How to handle user session along with jquery and php

itylerityler Member Posts: 1
I have a website that requires the user to choose 1 of 2 locations and then redirects to the website content running the appropriate jquery functions associated with each location choice. How can I handle a "session" with PHP once the user makes the location selection how can I carry that choice into the other pages of the website.
I already have a cookie being set and read with javascript but I would like the site to function properly even with out cookies.

Im not very experienced with PHP or sessions at all but to me it seems as though I need php to create and store a session variable once the location is selected but I am unsure of how to check the session info with jquery/javascript. Or even the proper way to create and end the session with PHP in this case. Thanks for the help!!

Comments

  • hyphentechhyphentech Member Posts: 3
    Hi,

    With the help of cookies you can handle these session along with jquery and php.


    [link=http://www.hyphentechnologies.in/website-designing.php]Website Design Company[/link] | [link=http://www.hyphentechnologies.in/graphic-designing.php]Graphics Design Services[/link]
  • warteswartes Member Posts: 3
    Hello,
    et a header in <,/head> -connection session-
    try to register the condition - if isset($session1) == set the desired value.
  • warteswartes Member Posts: 3
    Hello,
    et a header in [code]<,/head> -connection session-[/code]
    try to register the condition - [code]if isset($session1) == set the desired [/code]value.
  • BudnetCBEBudnetCBE Member Posts: 1
    You can't do it through jQuery alone; you'll need a combination of Ajax (which you can do with jQuery) and a PHP back-end. A very simple version might look like this:

    HTML:

    image
    image
    image

    Javascript:

    $("img.foo").onclick(function()
    {
    // Get the src of the image
    var src = $(this).attr("src");

    // Send Ajax request to backend.php, with src set as "img" in the POST data
    $.post("/backend.php", {"img": src});
    });

    PHP (backend.php):

    <?php<br /> // do any authentication first, then add POST variable to session
    $_SESSION['imgsrc'] = $_POST['img'];
    ?>

    [link=http://www.budnetdesign.com]How to web design contact us[/link]
    [link=http://www.budnetdesign.com]SEO COIMBATORE|WEB DESIGN COMPANY[/link]
  • warteswartes Member Posts: 3
    so the code will not work correctly -
    I do not advise to use the


    __________________________
    [link=http://watch-free-movie-online.net/]watch free movie online[/link]
Sign In or Register to comment.