Sorry if the topic title is misleading; I wasn't quite sure how to make it any more clear than that.
I want to parse all of the elements of a form and return them in a manageable form. For example, given the following form:
<form method="post" action="test.php">
<input type="text" name="sid" value="4d9f32ebc9">
<input type="text" name="name">
<input type="text" name="temp" value="1">
<input type="submit" name="test" value="test">
</form>
I would like to return something along the lines of
sid=4d9f32ebc9
name=
temp=1
test=test
I've isolated the form itself with the following code, but can't wrap my head around a good method to isolate all of the elements as long as any value associated with them:
$needle1=preg_quote("<form",'/');
$needle2=preg_quote("</form>",'/');
if(preg_match("/$needle1(.*?)$needle2/s", $return, $match))
$form = $match[1];
The one roadblock I can think of is determining whether or not a given element has a predefined value (and if it does, parsing that value). The solution would be much more straightforward if I was not concerned with pre-existing values of the elements, but I would like to grab those as well.
Just looking for a step in the right direction. Thanks!