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 6367117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:30:31+00:00 2026-05-25T00:30:31+00:00

Goal: I want to get the text from the selected element and then create

  • 0

Goal: I want to get the text from the selected element and then create a PHP variable from it.

I know how to do this using jQuery but can’t wrap my mind around the idea of how to do it in PHP. Basically lets say I have a table with some data. When the user clicks on the data I would like to retrieve that text and then place it in a PHP variable. I could use .text(); from jQuery to create the variable but I could not pass that variable into PHP for further use.

I am very new to PHP (a front-end developer trying to learn back-end). So any explanation would be helpful also.

thanks!

***OK I now understand how to do it. Thanks for the input. I was not thinking. It makes perfect sense to create the variable using a _post and then returning the data via AJAX. Sorry for wasting your time. Thanks for replying.

  • 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-25T00:30:31+00:00Added an answer on May 25, 2026 at 12:30 am

    In order to have PHP gather any client side data you would have to pass that data back to the server.

    To assign data from client action to a PHP variable, you would first have to capture that data using a front end solution (like your jQuery one above) then pass that information to your server application for processing using AJAX or form submission.

    Your PHP data handler could then parse that information out from the data submission and push that info into a variable.

    Your front end would look something like

    $.ajax({
        type: "POST",
        url: 'your_file.php',
        data: 'selected='+ captured_data,
    
    });
    

    and on your back end…

    <?php
     ...some php code...
    
     $var_to_hold_selected_thing = $_POST["selected"];
    
     ...more php code
    ?>
    

    Specifics of how to do more than that would depend on your application…

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

Sidebar

Related Questions

goal : I want to place a text after the submit button using hook_form_alter.
I've been using this code to try and get data from the google weather
My Goal: i want to create an horizontal list of images. when mouse is
I want to extract kernel symbols from a u-boot image The final goal is
My goal here is to make a button. I want the text to sit
My end goal is to get Erlang syntax highlighting in QsciScintilla using PyQt4 and
What I want is this (news ticker type functionality): Get a list of li's
Goal: Display Encapsulate field from Player Problem: Want to display datamember_id , _name and
my goal is to get lots of rows from a translation table. I use
I've recently started my new private project. The main goal which I want to

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.