Hi
I have used some of this code from the PHP manual, but I am bloody hopeless
with regular expressions.
Was hoping somebody could offer a hand.
The output of this will put the name of a form field beside name.
I want to get the following but not sure how to modify the code below.
1. Field Name (to appear beside NAME:)
2. Field Type (to appear beside TYPE:)
3. Field Value (to appear beside VALUE:)
Make sense.
It is part way there, just need some help finishing it.
$filename = "form-eg.php"; // Open file to read HTML with Form code
$fd = fopen ($filename, "rb");
$contents = fread ($fd, filesize ($filename));
preg_match_all ('/<input.*?name\\s*=\\s*"?([^\\s>"]*)/i', $contents,
$matches); // get all input fields and attributes and values
for ($i=0; $i< count($matches[0]); $i++) {
echo "matched: ".$matches[0][$i]."<br />\n";
echo "NAME: ".$matches[1][$i]."<br />\n";
echo "TYPE: ".$matches[3][$i]."<br />\n";
echo "VALUE: ".$matches[4][$i]."<br />\n\n";
}
fclose ($fd);
I will also need to run another check for :
<select
<textarea
But I can probably figure that out from what I already have.
Thanks,
YoBro