Build A Simple PHP Application: Stage 3 Adding A Contact Form
Build A Simple PHP Application: Stage 3 Adding A Contact Form
Build A Simple PHP Application: Stage 3 Adding A Contact Form
We have used 3 separate PHPs but we will now use 1 PHP for this purpose.
We will use conditionals in one file to activate in each circumstances.
First we deleted the process part from the contact.php
then we copied the code from contact-process.php to contact.php
Now we will add conditionals.
$_SERVER is an array with multiple elements in it. It is used to check
If the Request Method is Post we will send the email.
If the Request Method isn't post the form will be shown normally.
Exit; command ends the code and redirects to the thank you page.
6 Working with Get Variables.mp4
After we submit the form, php sends the email through header command
We need to show Thank you Page.
?status=thanks - ?variable with any name=value
This info is recorded in the special variable $_GET[status] we must
write the same variable name as was written in the code.