Using same php file to show form and receive the form's data

GreatDaneBetty

New Member
I have a php page that generates a form. The action attribute of the form is the page itself. After the user submits the form, the same page is loaded, but this time a POST variable is set, so the page runs another script to deal with the incoming data from the form. I do this by using a conditional fork:\[code\]if(isset($_POST['var'])){ generate form}else{ insert $_POST data into database}\[/code\]I'd like to know if this is ok or a bad idea.
 
Back
Top