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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:33:13+00:00 2026-05-26T19:33:13+00:00

I have following html form: <form method=post action=> <input type=hidden name=userid id=user value=<?php echo

  • 0

I have following html form:

 <form method="post" action="">
    <input type="hidden" name="userid" id="user" value="<?php echo $user ?>"/>
    <textarea name="comment" class="subcomment_form" id="ctextarea<?php echo $suggestid ?>"></textarea>
    <input type="submit" value="Post" id="<?php echo $suggestid ?>" class="form_btn" style="margin-top: 5px"/>
 </form>

following JS code:

$('.form_btn').live("click",function() 
{

var ID = $(this).attr("id");

var user= $("input[name=userid]").val();
var comment= $("#ctextarea"+ID).val();
var dataString = 'comment='+ comment + '&suggestid=' + ID + 'user' + user;

if(comment=='')
{
alert("Please Enter Comment Text");
}
else
{
$.ajax({
type: "POST",
url: "action/subcomment.php",
data: dataString,
cache: false,
success: function(html){
$("#commentload"+ID).append("html");
$("#ctextarea"+ID).val('');
$("#ctextarea"+ID).focus();
 }
 });
}
return false;
});

and following php code for subcomment.php file:

if($_POST['comment'])
{
$comment=$_POST['comment'];
$suggestid=$_POST['suggestid'];
$user=$_POST['user'];
$sql = "INSERT INTO user_suggestions_comments (uvd_id, user_id, usc_comment) VALUES ('".$_POST['suggestid']."', '".$_POST['user']."','".$_POST['comment']."')";
mysql_query( $sql);
}

the problem I have is that value from <input type="hidden" name="userid" id="user" value="<?php echo $user ?>"/> is not passed on php file and textarea content is passed. What I need to change inside that JS code to make it work?

  • 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-26T19:33:14+00:00Added an answer on May 26, 2026 at 7:33 pm

    It looks like your dataString is not being built to what your PHP code is expecting.
    Try this change.

    var dataString = 'comment='+ comment + '&suggestid=' + ID + 'user' + user;
    

    becomes

    var dataString = 'comment='+ comment + '&suggestid=' + ID + '&user=' + user;
    

    You are looking for three values from your $_POST and only passing 2

    $comment=$_POST['comment'];
    $suggestid=$_POST['suggestid'];
    $user=$_POST['user'];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following HTML <form id=create_form name=create_form action= method=post> <input name=type id=type value=individuel
I have the following form: form <?php echo '<td><form action=episodesdelete.php method=POST>'; echo '<input type=hidden
i have the following html code : <FORM name=frmmail> <input id=dochtmlContent type=hidden name=dochtmlContent value=oldValue/>
I have a form with the following HTML below: <form id=course_edit_form name=course_form action=/courses/save method=post>
Suppose I have the following HTML: <form id=myform> <input type='checkbox' name='foo[]'/> Check 1<br/> <input
I have following HTML form <form action=https://sandbox.paypal.com/cgi-bin/webscr method=post id=paypalpost name=paypalpost> <input type=hidden name=rm value=2/>
I have the following HTML form: <div id=main> <form Id=search-form action=/ViewRecord/AllRecord method=post> <div> <fieldset>
I have the following multi-select box in a HTML form, where user can select
I have the following HTML <select> element: <select id=leaveCode name=leaveCode> <option value=10>Annual Leave</option> <option
I have an included object's form: <form method=post class=object_form id=event-core-form action={% url save_event_core_data event.id

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.