6556

how to send data with form label element?

I should send data with form when submit button pressed.This value should be invisible and I used <label name=r_id id=r_id style="visible:hidden"> 1 </div>

This is my form

<form id="send_message" action="lib/send_message.php" method="post"> <textarea name="message" cols="45" rows="3" id="message"></textarea> <label name="r_id" id="r_id" style="visible:hidden"> 1 </label> <input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"> But in my .php file It shows only message ,id is empty.

I used $message= $_POST['message'] and $r_ID=$_POST['r_id'] ;

<strong>EDIT</strong>

I should write that this label value must be change.And I am changing it with Jquery where the mouse clicked it gets tags id.Can I change value attribute with Jquery ?

Answer1:

You're after a hidden input.

<input type="hidden" name="r_id" value="1"/>

Answer2:

input type="hidden"

are made for this and they won't appear if CSS are disabled (but of course they'll still appear in the HTML code)

Answer3:

LABELs are not form elements that can hold or send data. They are captions tied to form elements.

<INPUT TYPE="hidden" name="r_id" id="r_id" VALUE="1"/>

This should do what you want.

Recommend

  • How to use commands only when a current command is triggered?
  • How to pass hidden parameter to controller in Rails3
  • How to add a validated number to sinch sandbox
  • Can't retrieve jQuery serialized form data with PHP $_POST[] variable
  • Bootstrap (v3.3.4) glyphicons not displayed in IE when refresh page (F5)
  • How to get latest version of a artifact on Bintray using JSONP
  • During installation of Django, why do I keep getting ImportError: No module named django?
  • Implementing “partial void” in VB
  • Sending HTML Form Data to Spring REST Web Service
  • error importing numpy
  • Very simple C++ DLL that can be called from .net
  • FFmpeg Conversion Error
  • FileReader+canvas image loading problem
  • Java Scanner input dilemma. Automatically inputs without allowing user to type
  • Insert into database using onclick function
  • Retrieving value from sql ExecuteScalar()
  • Deselecting radio buttons while keeping the View Model in synch
  • Why HTML5 Canvas with a larger size stretch a drawn line?
  • Trying to switch camera back to front but getting exception
  • vba code to select only visible cells in specific column except heading
  • what is the difference between the asp.net mvc application and asp.net web application
  • Upload files with Ajax and Jquery
  • Do I've to free mysql result after storing it?
  • VB.net deserialize, JSON Conversion from type 'Dictionary(Of String,Object)' to type '
  • Transpose CSV data with awk (pivot transformation)
  • Matrix multiplication with MKL
  • A cron job substitute?
  • json Serialization in asp
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • Free memory of cv::Mat loaded using FileStorage API
  • Angular 2 constructor injection vs direct access
  • How do I configure my settings file to work with unit tests?
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • Programmatically clearing map cache
  • Sorting a 2D array using the second column C++
  • Binding checkboxes to object values in AngularJs
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?