Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Problem with PHP form Re: Problem with PHP form

#48709
ChrisBull
Member

I would recommend restructuring the page.
Keep it all in one file but have all of the php at the top and the html form at the bottom, like this,


PHP Code
?>

HTML Form

In the php section you can check if the form has been filled and posted to itself and if it has send the mail, if it hasn’t ie the viewing the page for the first time don’t do anything so they see the form, and if there are errors with the entries, display to form still but put echo statements inside the html code to display the errors.

Hope that helps