recommended way for server side validation - include in same file or have a different file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

I have always felt for reasons for cleanliness and clarity, it is
better to have the validation and insert / update statements in a
seperate file rather than have it in the same script.

Case 1
----------
//file:form.php
if $_POST
  then validate
  Insert or update on success
else
  if $_GET['primarykey'] then
     show form for editing
  else 
     show form for adding
fi
<form action="form.php" method=post>
Show form
</form>

Case 2
----------
//file:form1.php
  if $_GET['primarykey'] then
     show form for editing
  else 
     show form for adding
fi
<form action="formvalidate.php" method=post>
Show form
</form>



However in the second case, in case of an error, displaying the data
becomes an issue.

Any recommended ways for server side validation

-- 
Warm Regards
~~~~~~~~~~~~
Vinayak

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux