tags:

views:

32

answers:

1

If you're given a form in a string format like:

<input type="hidden" id="thisID" value="Text Value" />

How can you get the value "Text Value"? Also with:

<select name="thisSelect" size="1">
  <option value="one">One</option>
  <option value="two" selected>Two</option
  <option value="three">Three</option>
</select>

How can you get the value "two" or "Two"?

A: 

[edit] I might've misunderstood the question, if so, Lèse majesté posted a very useful comment.

For the hidden input, you need to set a name to it, otherwise it will not be sent. Once you've set a name to it, you can access it in PHP using $_POST:

$postedValue = $_POST['name_of_field'];

You can't access the text within the This text, that text is only providing information to the user on the available options, you can only access the value attribute, the same way as above:

$postedSelect = $_POST['thisSelect'];
Andrei Serdeliuc
That's only when you submit the form.one application can be when you export a table into xls format, you want to remove the form elements and remain just the text. How can you retain the values of the form elements?
Ainge