NogDog
I'm using it to parse out a template file.
Riddick
I'm thoroughly familiar with $_POST variables and the foreach loop. What I'm trying to do is this.
- Load the file into a variable (this I can do)
- Parse through the variable and by using regular expressions find all the form names (before I submit the form)
so for instance:
<form method = "POST">
<input type = "text" name = "myTitle" value = "myValue" />
<textarea name = "myDescription" rows = "8" cols = "40"></textarea>
</form>
If I submitted this form I could simply use the foreach loop to get the form names, but in this case I want to know what the names are BEFORE I submit it so that I can dynamically grab information from the database and input it into the template.
I could use text parsing to find it but that takes a lot of time and isn't as elegant nor as fast as regular expressions.
my best guess would be something like this:
$template = "
<form method = "POST">
<input type = \"text\" name = \"myTitle\" value = \"myValue\" />
<textarea name = \"myDescription\" rows = \"8\" cols = \"40\"></textarea>
</form>";
$regex = ereg("\bname\b[\s]*=\b\"[a-zA-Z0-9]*\"\b", $template, $regex);
I've studied regular expressions but I haven't practiced enough to be comfortable with them yet. So any kind of help would be appreciated.