1

I'm getting the question_id from db and I'm showing it in the input field. I want store that input value also in the $_SESSION.

How do I do this?

My code:

<div class="questionfun" onclick="return ChatLoginMax(event, <?php echo $chat_question_id; ?>);">
  <a href="javascript:void(0);">
    <p><?php echo $chat_question_title;?></p>
  </a>
</div>

<input type="text" id="chatquestionId" name="chatquestionName" value="">
    <?php 
        $_SESSION['session_name'] = $_GET['chat_question_id'];?>

Js:

function ChatLoginMax(event,chat_question_id){
   $("#chatquestionId").val(chat_question_id);
}
8
  • Any error in console ? Commented Oct 1, 2016 at 10:37
  • What $abc = "<script>document.getElementByID('chatquestionId').value</script>"; should do ? Commented Oct 1, 2016 at 10:38
  • $abc will hold the specified string, not the value of the input.. It is basics... Commented Oct 1, 2016 at 10:40
  • k Tq can you tell me how to make that id in session Commented Oct 1, 2016 at 10:42
  • 5
    You have two options, either submit the form and handle form submission using PHP or use AJAX Commented Oct 1, 2016 at 10:43

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.