How do I to retrieve the name and value from form elements?
e.g.: I should have an output like id=110kgod, checkbox=cancel, name=aj, age=23
I have heard of serialize but can that be applied?
<DIV style="BORDER-BOTTOM: blue 2px ridge; BORDER-LEFT: blue 2px ridge; WIDTH: 1000px; BORDER-TOP: blue 2px ridge; BORDER-RIGHT: blue 2px ridge" id=0_212099594_990000 class=mid>
<TABLE border=0 cellSpacing=0 cellPadding=0 width="100%" align=center>
<TBODY>
<TR vAlign=top align=middle width="100%" cellPadding="0" cellSpacing="0" border="0">
<TD width="15%"><H4>ID</H4></TD>
<TD width="5%"></TD>
<TD width="30%" align=left><INPUT onblur="this.style.backgroundColor='#fff'" class=input_0_212099594_990000 onfocus="this.style.backgroundColor='#ccc'" value=110KG0D name=ow_id> </TD>
<TD width="19%"></TD>
<TD style="BORDER-BOTTOM: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-RIGHT: black 1px solid" class=radiobutton width="20%" align=middle>YES<INPUT class=0_212099594_990000 disabled value=YES type=radio name=0_212099594_990000 jQuery172033007169320727875="2">NO<INPUT class=0_212099594_990000 disabled value=NO type=radio name=0_212099594_990000 jQuery172033007169320727875="3">MAYBE<INPUT class=0_212099594_990000 value=MAYBE CHECKED type=radio name=0_212099594_990000 jQuery172033007169320727875="4"></TD>
<TD width="5%" align=right><BUTTON style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; BACKGROUND-COLOR: white; BORDER-TOP: medium none; BORDER-RIGHT: medium none" onclick="javascript:ShowHide('0_212099594_990000')"><IMG src="../images/delete.png"></BUTTON>
</TD>
</TR>
</TBODY>
</TABLE>
<TABLE border=0 cellSpacing=0 cellPadding=0 width="98%" align=center>
<TBODY>
<TR vAlign=top align=left>
<TD style="PADDING-BOTTOM: 1em" width="9%" align=middle><FONT color=black size=2><B>NAME</B></FONT></TD>
<TD class=input_0_212099594_990000 width="8%" align=left><SELECT name=bsn_code> <OPTION selected value=a>A</OPTION> <OPTION value=B>B</OPTION> <OPTION value=C>C</OPTION> <OPTION value=D>D</OPTION> <OPTION value=OS>OS</OPTION></SELECT> </TD>
<TD vAlign=top width="10%" align=middle><FONT color=black size=2><B>Age</B> </FONT></TD>
<TD vAlign=top width="10%" align=left><INPUT onblur="this.style.backgroundColor='#fff'" class=input_0_212099594_990000 onfocus="this.style.backgroundColor='#ccc'" size=15 value=23 name=osi_cd> </TD>
<TD width="1%"></TD>
<TD class=input_0_212099594_990000 width="10%">22</TD>
<TD class=input_0_212099594_990000 width="30%"></TD>
</TR>
</TBODY>
</TABLE>
</DIV>
Serialize will give you the name/value of inputs within a given element/form
Leaving you with a string like
osi_cd=21&bsn_code=[SELECTED.VALUE]&....essentially a key/value pair based on input name and input value. Input type I believe is irrelevant with serialize.if Your want to capture more than just that you will need to cycle through the elements in the form manually in a matter of speaking, then build your own string to post with based off of that.
On a side note, your HTML isn’t very valid, and may cause some issues on some browsers especially some older ones.. all attributes custom or otherwise should always be lowercase and and enclosed in double quotes
example:
<input name="something" class="colorme" id="whatever" rel="something_else">then also depending on your choice of HTML formatting ie: XHTML, HTML5, other. You have to compensate for whats valid with those. W3C has a good validation page that you can feed a URL to and it will validate the HTML (this is good if you want the search engines to not penalize you and give you a lower index, also can save some headache when using javascript/jquery in the future)Overall back to the point though, you can mimic serialize through a bit of custom coding. Such as looping over elements within a given containing element or form tag and within that loop build out a string that would better suit your needs for posting.
Alternatively you could also use “hidden” elements to run serialize over that would get the pairs from each and build the string accordingly. In the end though its not going to be something simile as serialize and pass the data, some custom logic will need to be applied somewhere. To work with the data accordingly. Personally I would build a multidimensional array to then post based off of what I am gathering from your post is needed.