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

  • Home
  • SEARCH
  • 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 8070677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T13:28:10+00:00 2026-06-05T13:28:10+00:00

This is a topic selector made in <a> tag in php. Once user click

  • 0

This is a topic selector made in <a> tag in php. Once user click on trigger, the function pass value from the original <a> tag to another <input> tag for display purpose. then when user submits form, ajaxForm is called out to handle the rest.

js.file:

function selectopic(topic_selector_name){        
 $('#topicidselected').val($(topic_selector_name).val());
 // alert ($('#topicidselected').val());
 $('#topicidselected').text($(topic_selector_name).val());
 $('#topicselected').text($(topic_selector_name).text());
}

$('.topicselect').click(function(){
selectopic($(this));
}); 

$('#newentryform').ajaxForm({
    target:  '#para1', 
    resetForm: true,     
    });     

problem is, we suppose to have $_POST={"entry":"blahblahblah","topicid":"122","date":"12\/06\/12","privacy":"onlyme"}

but instead, it gives me Notice: Undefined index: topicid in D:\wamp\www\projectdiary\diary\php\_newentry.php on line 2

{"entry":"blahblahblah","topicid":null,"belongdate":"12\/06\/12","privacy":"onlyme"}

php.file:

$arr = array( 'entry' => $_POST['entry'], 'topicid' => $_POST['topicid'], 'date' => $_POST['date'], 'privacy' => $_POST['privacy']);
  echo "We have saved your entry, this is how it looks like: <br />";
      echo json_encode( $arr );

You can see in js.file I used alert to check the value after passed in. It is a correct number “122”.

I’m a noob, I need your help.
Thanks.

  • 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-06-05T13:28:15+00:00Added an answer on June 5, 2026 at 1:28 pm

    Why are you assigning the value to topicselected and setting the text property (not proper use, see the docs)? You’re clicking a tags and getting the val() of them? See the docs there: http://api.jquery.com/val/ — also not valid. Maybe I’ve misunderstood you?

    I think you’re trying harder than you have to, this could be accomplished in one line:

    jQuery('.topicselect').click(function(){$('#topicidselected').val(this.rel);}); 
    

    jsFiddle: http://jsfiddle.net/KNERB/

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

Sidebar

Related Questions

I come here from this topic Where user has exactly the same problem. I
This topic has been scratched once or twice, but I am still puzzled. And
This topic is a remark for PHP get image src So we have a
This is my second question about this topic, the original question can be found
Related to This topic I wonder if anyone has made the Microsoft Charting library
I've seen this Topic : Creating an instance from a class name and written
I googled this topic hard and found only references from 2007... I guess things
This topic is related to Copy missing rows from one table to another in
This topic can look similar to others but I haven't found any usable answer
I Googled this topic, and could not find an answer. I am working on

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.