Re: Form validation and save the form

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

 



On Mon, Jan 11, 2010 at 10:18 AM, Angelo Zanetti <angelo@xxxxxxxxxxxx> wrote:
>
>
> -----Original Message-----
> From: aditya shukla [mailto:adityashukla1983@xxxxxxxxx]
> Sent: 11 January 2010 05:03 PM
> To: Robert Cummings
> Cc: Angelo Zanetti; php-general
> Subject: Re:  Form validation and save the form
>
> Thanks for the reply guys.Do you guys know a good resource where i can read
> from about form validation through PHP.There a lot on google but please
> suggest something if you guys know.
>
>
> Thanks
>
> Aditya
>
> I think just do some form validation tutorials (google for them).
> These will help you to understand the validation process in more detail.
>
> Regards
> Angelo
> http://www.elemental.co.za
> http://www.wapit.co.za
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


I still like

<?php

// includes go here

if(isset($_POST['submit'])){
  process_form();
}else{
  show_form();
}//end if

function process_form()
{
//receive the data, validate and store the data in the db goes here
//feel free to add more functions that you could re-use in other parts
//of the app


}

function show_form($data='', $errors='')
{
//code to show the form goes here
//$data and $errors could be passed in from the above function if
//there are issues with the data validation (no image, data missing etc)


}

for simple pages. Its a mini MVC where the code could post the data
back to the form with error message to indicate to the user what
should be done.
-- 

Bastien

Cat, the other other white meat

-- 
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