Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3457374
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T09:51:08+00:00 2026-05-18T09:51:08+00:00

I am working with the following code: action.php <?php $_SESSION[‘passtext’] = $_POST[‘passtext’]; ?> index.php

  • 0

I am working with the following code:

action.php

<?php
$_SESSION['passtext'] = $_POST['passtext'];
?>

index.php

<script type="text/javascript">
$(function(){
    $("#clickable").click(function() {
        $.post("action.php", { passtext: "Hello" } );
        alert('refresh the page to see the session text');
    });
});
</script>

<a href="javascript:void(0);" id="clickable">click me to set session text</a>

<?php if(isset($_SESSION['passtext'])) echo $_SESSION['passtext']; ?>

When I click the link, I get the alert, but it seems that action.php isn’t running at all — because I will refresh the page and I see no echo of $_SESSION[‘passtext’] (it isn’t being set)

There are no errors in the Error Console either

What am I missing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T09:51:09+00:00Added an answer on May 18, 2026 at 9:51 am

    You need to add this line at the beginning of your files before you deal with sessions:

    session_start();
    

    From the PHP docs:

    session_start() creates a session or
    resumes the current one based on a
    session identifier passed via a GET or
    POST request, or passed via a cookie.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code. PHP side: <?php print_r($_POST); print_r($_GET); die(); ?> In JavaScript:
I'm working with some old PHP code that has a lot of the following:
Working with the following code, I need to return only records where the `point'
I'm trying to get the following code working: string url = String.Format(@SOMEURL); string user
Why is the following code (in cocoa) not working? NSString *extension = [fileName pathExtension];
I have the following Clojure code and I'm not sure why it's not working:
Is the following stored procedure code robust for multi-user application. It is working fine.
In tcsh , I have the following script working: #!/bin/tcsh setenv X_ROOT /some/specified/path setenv
I'm a real newbie with php and MySQL. Now I'm working on the following
The following code was working very well. Suddenly, the Edit button click stopped working.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.