form1.php
Code: Select all
<FORM METHOD='POST' ACTION='somepage.php'>
<TABLE>
<TR>
<TD>Field 1</TD>
<TD><INPUT TYPE='TEXT' NAME='whatevername'></TD>
</TR>
</TABLE>
<INPUT TYPE='SUBMIT' VALUE='Submit'>
</FORM>
Code: Select all
$post1 = $_POST['whatevername'];
$obj->doSomethingWithPostVariables($post1);If I'm understanding MVC concepts correctly (and I'm not claiming that I am), I would think a better way to build applications would be to:
1. Have a database table that links each page with what fields a particular page's form should have
2. On the form page, populate the form with data from table in step 1.
3. On the post page, have the page determine the referrer (or perhaps pass it through as a querystring
4. Then have a method for the post page to extract the fields the referring page should have posted
5. Then the post page can do what it needs to with the posted variables
If it were done like this, it seems like it would be a good way to separate view components, and be more MVC-compliant.
Am I understanding MVC correctly, here? Does doing it this way make sense?