Posted by Vinayakam Murugan on 03/08/05 13:11
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
[Back to original message]
|